Skip to content

Commit 3c26b08

Browse files
committed
[VAULT-34754] Refactor Test_ConcurrentCompileInternedRegexps to also exercise MustCompileInterned; fixed a typo in the godoc comment
1 parent 9105996 commit 3c26b08

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

regexp/regexp_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,13 @@ func TestCleanupCorrectKind(t *testing.T) {
138138
l.Unlock()
139139
}
140140

141-
// Test_ConcurrentInternedRegexps tests that multiple goroutines can compile
141+
// Test_ConcurrentCompileInternedRegexps tests that multiple goroutines can compile
142142
// and use interned regular expressions concurrently without issues.
143143
// We spin up a number of goroutines that compile the same interned regexp
144144
// and hold on to it for a second. If there are any issues with concurrent access,
145145
// this test should trip the race detector.
146146
func Test_ConcurrentCompileInternedRegexps(t *testing.T) {
147+
t.Parallel()
147148
var wg sync.WaitGroup
148149
pattern := ".*"
149150

@@ -154,10 +155,12 @@ func Test_ConcurrentCompileInternedRegexps(t *testing.T) {
154155
defer wg.Done()
155156
exp, err := CompileInterned(pattern)
156157
require.NoError(t, err)
158+
exp2 := MustCompileInterned(pattern)
157159
// We want to hold a reference to the compiled regexp to ensure it is not
158160
// garbage collected before other goroutines are spun up.
159161
time.Sleep(1 * time.Second)
160162
exp.Match([]byte("test"))
163+
exp2.Match([]byte("test"))
161164
}()
162165
}
163166
wg.Wait()

0 commit comments

Comments
 (0)