Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions jit/jit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,29 @@ func TestTypeMismatch(t *testing.T) {

}

func TestIssue96(t *testing.T) {
conf := baseConfig

data := testData{
files: []string{"./testdata/test_issue96/test.go"},
pkg: "./testdata/test_issue96",
}
testNames := []string{"BuildGoFiles", "BuildGoPackage", "BuildGoText"}
for _, testName := range testNames {
t.Run(testName, func(t *testing.T) {
module, symbols := buildLoadable(t, conf, testName, data)

testFunc := symbols["NewStructX"]
results := reflect.ValueOf(testFunc).Call(nil)
fmt.Println(results[0].Interface().(interface{ Do() error }).Do())
err := module.Unload()
if err != nil {
t.Fatal(err)
}
})
}
}

func TestRemotePkgs(t *testing.T) {
// This test tries to build some massive real world packages as a smoke test.
// Ideally in future we'd also build and run the tests for those packages as JIT modules to prove everything works
Expand Down
19 changes: 19 additions & 0 deletions jit/testdata/test_issue96/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package test_issue96

import "fmt"

type (
IDo interface {
Do() error
}
Struct1 struct{}
)

func (Struct1) Do() error {
fmt.Print("DO SOMETHING\n")
return nil
}

func NewStructX() IDo {
return Struct1{}
}