Skip to content

Commit

Permalink
Add more unit tests for parameter decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Oct 27, 2024
1 parent 101d76a commit 11f7839
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stmt/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func TestDecodeParamsGetAll(t *testing.T) {
{` `, nil, nil},
{` :foo`, []string{`bar`}, nil},
{` :'foo`, nil, text.ErrUnterminatedQuotedString},
{` :'型示師`, nil, text.ErrUnterminatedQuotedString},
{` :"型示師`, nil, text.ErrUnterminatedQuotedString},
{` :'型示師 `, nil, text.ErrUnterminatedQuotedString},
{` :"型示師 `, nil, text.ErrUnterminatedQuotedString},
{`:'foo'`, []string{`'bar'`}, nil},
{` :'foo' `, []string{`'bar'`}, nil},
{`:'foo':foo`, []string{`'bar'bar`}, nil},
Expand Down Expand Up @@ -86,6 +90,9 @@ func TestDecodeParamsGetAll(t *testing.T) {
{` :'foo''yes':'foo' `, []string{`'bar'yes'bar'`}, nil},
{` :'foo' 'yes' :'foo' `, []string{`'bar'`, `yes`, `'bar'`}, nil},
{` 'yes':'foo':"foo"'blah''no' "\ntest" `, []string{`yes'bar'"bar"blah'no`, "\ntest"}, nil},
{`:型示師:'型示師':"型示師"`, []string{`:型示師:'型示師':"型示師"`}, nil},
{`:型示師 :'型示師' :"型示師"`, []string{`:型示師`, `:'型示師'`, `:"型示師"`}, nil},
{` :型示師 :'型示師' :"型示師" `, []string{`:型示師`, `:'型示師'`, `:"型示師"`}, nil},
}
for i, test := range tests {
t.Run(strconv.Itoa(i), func(t *testing.T) {
Expand Down

0 comments on commit 11f7839

Please sign in to comment.