@@ -1644,33 +1644,32 @@ func TestLen(t *testing.T) {
1644
1644
ch <- 3
1645
1645
1646
1646
cases := []struct {
1647
- v interface {}
1648
- l int
1649
- format string
1647
+ v interface {}
1648
+ l int
1649
+ expected1234567 string // message when expecting 1234567 items
1650
1650
}{
1651
- {[]int {1 , 2 , 3 }, 3 , "[1 2 3]" },
1652
- {[... ]int {1 , 2 , 3 }, 3 , "[1 2 3]" },
1653
- {"ABC" , 3 , "ABC" },
1654
- {map [int ]int {1 : 2 , 2 : 4 , 3 : 6 }, 3 , "map[1:2 2:4 3:6]" },
1651
+ {[]int {1 , 2 , 3 }, 3 , ` "[1 2 3]" should have 1234567 item(s), but has 3` },
1652
+ {[... ]int {1 , 2 , 3 }, 3 , ` "[1 2 3]" should have 1234567 item(s), but has 3` },
1653
+ {"ABC" , 3 , ` "ABC" should have 1234567 item(s), but has 3` },
1654
+ {map [int ]int {1 : 2 , 2 : 4 , 3 : 6 }, 3 , ` "map[1:2 2:4 3:6]" should have 1234567 item(s), but has 3` },
1655
1655
{ch , 3 , "" },
1656
1656
1657
- {[]int {}, 0 , "[]" },
1658
- {map [int ]int {}, 0 , "map[]" },
1657
+ {[]int {}, 0 , ` "[]" should have 1234567 item(s), but has 0` },
1658
+ {map [int ]int {}, 0 , ` "map[]" should have 1234567 item(s), but has 0` },
1659
1659
{make (chan int ), 0 , "" },
1660
1660
1661
- {[]int (nil ), 0 , "[]" },
1662
- {map [int ]int (nil ), 0 , "map[]" },
1663
- {(chan int )(nil ), 0 , "<nil>" },
1661
+ {[]int (nil ), 0 , ` "[]" should have 1234567 item(s), but has 0` },
1662
+ {map [int ]int (nil ), 0 , ` "map[]" should have 1234567 item(s), but has 0` },
1663
+ {(chan int )(nil ), 0 , ` "<nil>" should have 1234567 item(s), but has 0` },
1664
1664
}
1665
1665
1666
1666
for _ , c := range cases {
1667
1667
True (t , Len (mockT , c .v , c .l ), "%#v have %d items" , c .v , c .l )
1668
1668
False (t , Len (mockT , c .v , c .l + 1 ), "%#v have %d items" , c .v , c .l )
1669
- if c .format != "" {
1669
+ if c .expected1234567 != "" {
1670
1670
msgMock := new (mockTestingT )
1671
1671
Len (msgMock , c .v , 1234567 )
1672
- want := fmt .Sprintf (`"%s" should have 1234567 item(s), but has %d` , c .format , c .l )
1673
- Contains (t , msgMock .errorString (), want )
1672
+ Contains (t , msgMock .errorString (), c .expected1234567 )
1674
1673
}
1675
1674
}
1676
1675
}
0 commit comments