Skip to content

Commit 7da8182

Browse files
committed
added some tests
1 parent 8e44396 commit 7da8182

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

pkg/paralleltest/testdata/src/t/t_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,57 @@ func TestFunctionWithSetenvRange(t *testing.T) {
217217
})
218218
}
219219
}
220+
221+
// Test cases for paralleltest package edge cases
222+
func TestParalleltestEdgeCases(t *testing.T) {
223+
t.Parallel()
224+
225+
t.Run("edge_cases", func(t *testing.T) {
226+
t.Parallel()
227+
228+
// Test nil test case
229+
t.Run("nil_test", func(t *testing.T) {
230+
t.Parallel()
231+
// Test handling of nil test case
232+
func() {
233+
defer func() {
234+
if r := recover(); r == nil {
235+
t.Error("Expected panic for nil test case")
236+
}
237+
}()
238+
var nilTest *testing.T
239+
nilTest.Parallel()
240+
}()
241+
})
242+
243+
// Test empty test case
244+
t.Run("empty_test", func(t *testing.T) {
245+
t.Parallel()
246+
// Test handling of empty test case
247+
func() {
248+
defer func() {
249+
if r := recover(); r == nil {
250+
t.Error("Expected panic for empty test case")
251+
}
252+
}()
253+
var emptyTest testing.T
254+
emptyTest.Parallel()
255+
}()
256+
})
257+
258+
// Test invalid test case
259+
t.Run("invalid_test", func(t *testing.T) {
260+
t.Parallel()
261+
// Test handling of invalid test case
262+
func() {
263+
defer func() {
264+
if r := recover(); r == nil {
265+
t.Error("Expected panic for invalid test case")
266+
}
267+
}()
268+
var invalidTest interface{}
269+
invalidTest.(*testing.T).Parallel()
270+
}()
271+
})
272+
})
273+
}

0 commit comments

Comments
 (0)