File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,13 @@ func TestCleanupCorrectKind(t *testing.T) {
138
138
l .Unlock ()
139
139
}
140
140
141
- // Test_ConcurrentInternedRegexps tests that multiple goroutines can compile
141
+ // Test_ConcurrentCompileInternedRegexps tests that multiple goroutines can compile
142
142
// and use interned regular expressions concurrently without issues.
143
143
// We spin up a number of goroutines that compile the same interned regexp
144
144
// and hold on to it for a second. If there are any issues with concurrent access,
145
145
// this test should trip the race detector.
146
146
func Test_ConcurrentCompileInternedRegexps (t * testing.T ) {
147
+ t .Parallel ()
147
148
var wg sync.WaitGroup
148
149
pattern := ".*"
149
150
@@ -154,10 +155,12 @@ func Test_ConcurrentCompileInternedRegexps(t *testing.T) {
154
155
defer wg .Done ()
155
156
exp , err := CompileInterned (pattern )
156
157
require .NoError (t , err )
158
+ exp2 := MustCompileInterned (pattern )
157
159
// We want to hold a reference to the compiled regexp to ensure it is not
158
160
// garbage collected before other goroutines are spun up.
159
161
time .Sleep (1 * time .Second )
160
162
exp .Match ([]byte ("test" ))
163
+ exp2 .Match ([]byte ("test" ))
161
164
}()
162
165
}
163
166
wg .Wait ()
You can’t perform that action at this time.
0 commit comments