Skip to content

Commit 92cc0f7

Browse files
committed
Extract subtests
1 parent e025293 commit 92cc0f7

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

string_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -555,19 +555,23 @@ func TestString_MatchOne(t *testing.T) {
555555

556556
value := NewString(reporter, "http://example.com/users/john")
557557

558-
m1 := value.Match(`http://(?P<host>.+)/users/(?P<user>.+)`)
559-
m1.chain.assertNotFailed(t)
558+
t.Run("named", func(t *testing.T) {
559+
m := value.Match(`http://(?P<host>.+)/users/(?P<user>.+)`)
560+
m.chain.assertNotFailed(t)
560561

561-
assert.Equal(t,
562-
[]string{"http://example.com/users/john", "example.com", "john"},
563-
m1.submatches)
562+
assert.Equal(t,
563+
[]string{"http://example.com/users/john", "example.com", "john"},
564+
m.submatches)
565+
})
564566

565-
m2 := value.Match(`http://(.+)/users/(.+)`)
566-
m2.chain.assertNotFailed(t)
567+
t.Run("unnamed", func(t *testing.T) {
568+
m := value.Match(`http://(.+)/users/(.+)`)
569+
m.chain.assertNotFailed(t)
567570

568-
assert.Equal(t,
569-
[]string{"http://example.com/users/john", "example.com", "john"},
570-
m2.submatches)
571+
assert.Equal(t,
572+
[]string{"http://example.com/users/john", "example.com", "john"},
573+
m.submatches)
574+
})
571575
}
572576

573577
func TestString_MatchAll(t *testing.T) {

0 commit comments

Comments
 (0)