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) {
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.
146146func 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 ()
You can’t perform that action at this time.
0 commit comments