promise add missing ref and remove syncOnce

This commit is contained in:
RSWilli
2024-08-22 17:38:55 +02:00
parent 9ced43ae83
commit 1f659f1f14
2 changed files with 9 additions and 11 deletions

View File

@@ -4,10 +4,8 @@ import (
"context"
"errors"
"runtime"
"sync"
"testing"
"time"
"unsafe"
)
//go:noinline
@@ -35,9 +33,7 @@ func awaitGC() {
}
func TestPromise(t *testing.T) {
initOnce.Do(func() {
Init(nil)
})
Init(nil)
prom := NewPromise()
cprom := prom.Instance()
@@ -87,12 +83,8 @@ func TestPromise(t *testing.T) {
awaitGC()
}
var initOnce sync.Once
func TestPromiseMarshal(t *testing.T) {
initOnce.Do(func() {
Init(nil)
})
Init(nil)
prom := NewPromise()
@@ -102,7 +94,7 @@ func TestPromiseMarshal(t *testing.T) {
t.Fatal(err)
}
receivedPromI, err := marshalPromise(unsafe.Pointer(gv.GValue))
receivedPromI, err := gv.GoValue()
if err != nil {
t.Fatal(err)