Update fmt_test.go
- add test for double-digit, three-digit and four-digit argument index using common slice object (via @verytable comment)
This commit is contained in:
parent
6b51d2e906
commit
4dfb967b78
1 changed files with 18 additions and 3 deletions
|
@ -9,6 +9,11 @@ import (
|
|||
)
|
||||
|
||||
func TestFormat(t *testing.T) {
|
||||
var interfaceSlice []interface{} = make([]interface{}, 1002)
|
||||
interfaceSlice[10] = 1
|
||||
interfaceSlice[100] = 1
|
||||
interfaceSlice[1000] = 1
|
||||
|
||||
for _, tc := range []struct {
|
||||
format string
|
||||
args []interface{}
|
||||
|
@ -45,9 +50,19 @@ func TestFormat(t *testing.T) {
|
|||
result: "Hello, World",
|
||||
},
|
||||
{
|
||||
format: "{10}",
|
||||
args: []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
|
||||
result: "10",
|
||||
format: "check {10}",
|
||||
args: interfaceSlice[:11],
|
||||
result: "check 1",
|
||||
},
|
||||
{
|
||||
format: "check {100}",
|
||||
args: interfaceSlice[:101],
|
||||
result: "check 1",
|
||||
},
|
||||
{
|
||||
format: "check {1000}",
|
||||
args: interfaceSlice[:1001],
|
||||
result: "check 1",
|
||||
},
|
||||
} {
|
||||
t.Run(tc.result, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue