Skip to content

Commit 1a46618

Browse files
author
anatoly32322
committed
Add test for calling stack.FunctionID from anonymous go call
1 parent 12a90c9 commit 1a46618

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/stack/function_id_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package stack
22

33
import (
44
"testing"
5+
"time"
56

67
"github.com/stretchr/testify/require"
78
)
@@ -22,6 +23,15 @@ func (e *starType) starredCall() string {
2223
return FunctionID("").FunctionID()
2324
}
2425

26+
func anonymousFunctionCall() string {
27+
var result string
28+
go func() {
29+
result = FunctionID("").FunctionID()
30+
}()
31+
time.Sleep(time.Second)
32+
return result
33+
}
34+
2535
func TestFunctionIDForGenericType(t *testing.T) {
2636
t.Run("StaticFunc", func(t *testing.T) {
2737
require.Equal(t,
@@ -42,4 +52,10 @@ func TestFunctionIDForGenericType(t *testing.T) {
4252
x.starredCall(),
4353
)
4454
})
55+
t.Run("AnonymousFunctionCall", func(t *testing.T) {
56+
require.Equal(t,
57+
"github.com/ydb-platform/ydb-go-sdk/v3/internal/stack.anonymousFunctionCall",
58+
anonymousFunctionCall(),
59+
)
60+
})
4561
}

0 commit comments

Comments
 (0)