github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/tests/vendored_test.go (about) 1 package tests_test 2 3 import ( 4 "os" 5 "os/exec" 6 "runtime" 7 "testing" 8 ) 9 10 // Test that GopherJS can be vendored into a project, and then used to build Go programs. 11 // See issue https://github.com/gopherjs/gopherjs/issues/415. 12 func TestGopherJSCanBeVendored(t *testing.T) { 13 if runtime.GOOS == "js" { 14 t.Skip("test meant to be run using normal Go compiler (needs os/exec)") 15 } 16 if runtime.GOOS == "windows" { 17 t.Skip("test requires POSIX environment to run") 18 } 19 20 cmd := exec.Command("sh", "gopherjsvendored_test.sh") 21 cmd.Stderr = os.Stdout 22 got, err := cmd.Output() 23 if err != nil { 24 t.Fatal(err) 25 } 26 if want := "hello using js pkg\n"; string(got) != want { 27 t.Errorf("unexpected stdout from gopherjsvendored_test.sh:\ngot:\n%s\nwant:\n%s", got, want) 28 } 29 }