github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/sync/pool_test.go (about)

     1  //go:build js
     2  // +build js
     3  
     4  package sync_test
     5  
     6  import (
     7  	. "sync"
     8  	"testing"
     9  )
    10  
    11  func TestPool(t *testing.T) {
    12  	var p Pool
    13  	if p.Get() != nil {
    14  		t.Fatal("expected empty")
    15  	}
    16  
    17  	p.Put("a")
    18  	p.Put("b")
    19  
    20  	want := []interface{}{"b", "a", nil}
    21  	for i := range want {
    22  		got := p.Get()
    23  		if got != want[i] {
    24  			t.Fatalf("Got: p.Get() returned: %s. Want: %s.", got, want)
    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  }