Skip to content

Commit

Permalink
add case for package-patch issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Aug 28, 2024
1 parent 77ce770 commit cfef31b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions gopbuild/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,26 @@ func main() {
t.Fatal("build error:\n", string(data))
}
}

func TestPackagePatchRun(t *testing.T) {
ctx := igop.NewContext(0)
RegisterPackagePatch(ctx, "github.com/qiniu/x/gsh", `package gsh
type Point struct {
X int
Y int
}`)
src := `
println 1
`
data, err := BuildFile(ctx, "main.gsh", src)
if err != nil {
t.Fatal(err)
}
code, err := ctx.RunFile("main.go", data, nil)
if err != nil {
t.Fatal("RunFile error:", err)
}
if code != 0 {
t.Fatal("run error:", code)
}
}

0 comments on commit cfef31b

Please sign in to comment.