aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/syscall/js/js_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/syscall/js/js_test.go')
-rw-r--r--libgo/go/syscall/js/js_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/libgo/go/syscall/js/js_test.go b/libgo/go/syscall/js/js_test.go
index 5fc9107..f860a5b 100644
--- a/libgo/go/syscall/js/js_test.go
+++ b/libgo/go/syscall/js/js_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build js,wasm
+//go:build js && wasm
// To run these tests:
//
@@ -364,8 +364,8 @@ func TestType(t *testing.T) {
}
}
-type object = map[string]interface{}
-type array = []interface{}
+type object = map[string]any
+type array = []any
func TestValueOf(t *testing.T) {
a := js.ValueOf(array{0, array{0, 42, 0}, 0})
@@ -388,7 +388,7 @@ func TestZeroValue(t *testing.T) {
func TestFuncOf(t *testing.T) {
c := make(chan struct{})
- cb := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ cb := js.FuncOf(func(this js.Value, args []js.Value) any {
if got := args[0].Int(); got != 42 {
t.Errorf("got %#v, want %#v", got, 42)
}
@@ -402,8 +402,8 @@ func TestFuncOf(t *testing.T) {
func TestInvokeFunction(t *testing.T) {
called := false
- cb := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
- cb2 := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ cb := js.FuncOf(func(this js.Value, args []js.Value) any {
+ cb2 := js.FuncOf(func(this js.Value, args []js.Value) any {
called = true
return 42
})
@@ -423,7 +423,7 @@ func TestInterleavedFunctions(t *testing.T) {
c1 := make(chan struct{})
c2 := make(chan struct{})
- js.Global().Get("setTimeout").Invoke(js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ js.Global().Get("setTimeout").Invoke(js.FuncOf(func(this js.Value, args []js.Value) any {
c1 <- struct{}{}
<-c2
return nil
@@ -432,7 +432,7 @@ func TestInterleavedFunctions(t *testing.T) {
<-c1
c2 <- struct{}{}
// this goroutine is running, but the callback of setTimeout did not return yet, invoke another function now
- f := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ f := js.FuncOf(func(this js.Value, args []js.Value) any {
return nil
})
f.Invoke()
@@ -440,7 +440,7 @@ func TestInterleavedFunctions(t *testing.T) {
func ExampleFuncOf() {
var cb js.Func
- cb = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ cb = js.FuncOf(func(this js.Value, args []js.Value) any {
fmt.Println("button clicked")
cb.Release() // release the function if the button will not be clicked again
return nil
@@ -593,7 +593,7 @@ func BenchmarkDOM(b *testing.B) {
}
func TestGlobal(t *testing.T) {
- ident := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ ident := js.FuncOf(func(this js.Value, args []js.Value) any {
return args[0]
})
defer ident.Release()