Skip to content

Commit a61ea37

Browse files
committed
Update sync tests for Go 1.16.
1 parent 0f95ecf commit a61ea37

File tree

6 files changed

+65
-30
lines changed

6 files changed

+65
-30
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//+build js
2+
3+
package sync_test
4+
5+
import "testing"
6+
7+
func TestCondCopy(t *testing.T) {
8+
t.Skip("Copy checker requires raw pointers, which GopherJS doesn't fully support.")
9+
}

compiler/natives/src/sync/export_test.go

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//+build js
2+
3+
package sync_test
4+
5+
import "testing"
6+
7+
func TestIssue40999(t *testing.T) {
8+
t.Skip("test relies on runtime.SetFinalizer, which GopherJS does not implement")
9+
}

compiler/natives/src/sync/pool.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ func (p *Pool) Put(x interface{}) {
4343
}
4444
p.store = append(p.store, x)
4545
}
46+
47+
// These are referenced by tests, but are no-ops in GopherJS runtime.
48+
func runtime_procPin() int { return 0 }
49+
func runtime_procUnpin() {}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// +build js
2+
3+
package sync_test
4+
5+
import (
6+
. "sync"
7+
"testing"
8+
)
9+
10+
func TestPool(t *testing.T) {
11+
var p Pool
12+
if p.Get() != nil {
13+
t.Fatal("expected empty")
14+
}
15+
16+
p.Put("a")
17+
p.Put("b")
18+
19+
want := []interface{}{"b", "a", nil}
20+
for i := range want {
21+
got := p.Get()
22+
if got != want[i] {
23+
t.Fatalf("Got: p.Get() returned: %s. Want: %s.", got, want)
24+
}
25+
}
26+
27+
}
28+
29+
func TestPoolGC(t *testing.T) {
30+
t.Skip("This test uses runtime.GC(), which GopherJS doesn't support.")
31+
}
32+
33+
func TestPoolRelease(t *testing.T) {
34+
t.Skip("This test uses runtime.GC(), which GopherJS doesn't support.")
35+
}
36+
37+
func TestPoolDequeue(t *testing.T) {
38+
t.Skip("This test targets upstream pool implementation, which is not used by GopherJS.")
39+
}
40+
41+
func TestPoolChain(t *testing.T) {
42+
t.Skip("This test targets upstream pool implementation, which is not used by GopherJS.")
43+
}

compiler/natives/src/sync/sync_test.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)