forked from TrueCloudLab/neoneo-go
compiler/test: use public functions in tests
`CompileWithOptions` does exactly the thing we need. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
42769d11ff
commit
46f623a48f
1 changed files with 2 additions and 18 deletions
|
@ -67,17 +67,8 @@ func (ms *MyStruct) MethodOnPointerToStruct() { }
|
|||
func _deploy(data interface{}, isUpdate bool) { x := 1; _ = x }
|
||||
`
|
||||
|
||||
info, err := getBuildInfo("foo.go", src)
|
||||
buf, d, err := CompileWithOptions("foo.go", strings.NewReader(src), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
pkg := info.program.Package(info.initialPackage)
|
||||
c := newCodegen(info, pkg)
|
||||
require.NoError(t, c.compile(info, pkg))
|
||||
|
||||
buf, err := c.writeJumps(c.prog.Bytes())
|
||||
require.NoError(t, err)
|
||||
|
||||
d := c.emitDebugInfo(buf)
|
||||
require.NotNil(t, d)
|
||||
|
||||
t.Run("return types", func(t *testing.T) {
|
||||
|
@ -308,15 +299,8 @@ func TestSequencePoints(t *testing.T) {
|
|||
return false
|
||||
}`
|
||||
|
||||
info, err := getBuildInfo("foo.go", src)
|
||||
_, d, err := CompileWithOptions("foo.go", strings.NewReader(src), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
pkg := info.program.Package(info.initialPackage)
|
||||
c := newCodegen(info, pkg)
|
||||
require.NoError(t, c.compile(info, pkg))
|
||||
|
||||
buf := c.prog.Bytes()
|
||||
d := c.emitDebugInfo(buf)
|
||||
require.NotNil(t, d)
|
||||
|
||||
require.Equal(t, d.Documents, []string{"foo.go"})
|
||||
|
|
Loading…
Reference in a new issue