30 lines
407 B
Go
30 lines
407 B
Go
package client_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"apigo.cc/gojs"
|
|
"apigo.cc/gojs/client"
|
|
)
|
|
|
|
func TestClient(t *testing.T) {
|
|
gojs.ExportForDev()
|
|
testOK := false
|
|
client.Bind("setTestOK", func(testIsOK bool) {
|
|
testOK = testIsOK
|
|
})
|
|
|
|
r, err := gojs.RunFile("client.js")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
gojs.WaitAll()
|
|
|
|
if !testOK {
|
|
t.Fatal("test failed")
|
|
} else {
|
|
fmt.Println("test OK", r)
|
|
}
|
|
}
|