Last active
June 24, 2022 02:41
-
-
Save cep21/6769d3be13d3d752ffa0596fca9b1192 to your computer and use it in GitHub Desktop.
Example test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"sync" | |
"testing" | |
) | |
func TestAppend(t *testing.T) { | |
x := []string{"start"} | |
wg := sync.WaitGroup{} | |
wg.Add(2) | |
go func() { | |
defer wg.Done() | |
y := append(x, "hello", "world") | |
t.Log(cap(y), len(y)) | |
}() | |
go func() { | |
defer wg.Done() | |
z := append(x, "goodbye", "bob") | |
t.Log(cap(z), len(z)) | |
}() | |
wg.Wait() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment