File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,24 @@ func TestAnyTimeArgument(t *testing.T) {
3535 t .Errorf ("there were unfulfilled expections: %s" , err )
3636 }
3737}
38+
39+ func TestByteSliceArgument (t * testing.T ) {
40+ t .Parallel ()
41+ db , mock , err := New ()
42+ if err != nil {
43+ t .Errorf ("an error '%s' was not expected when opening a stub database connection" , err )
44+ }
45+ defer db .Close ()
46+
47+ username := []byte ("user" )
48+ mock .ExpectExec ("INSERT INTO users" ).WithArgs (username ).WillReturnResult (NewResult (1 , 1 ))
49+
50+ _ , err = db .Exec ("INSERT INTO users(username) VALUES (?)" , username )
51+ if err != nil {
52+ t .Errorf ("error '%s' was not expected, while inserting a row" , err )
53+ }
54+
55+ if err := mock .ExpectationsWereMet (); err != nil {
56+ t .Errorf ("there were unfulfilled expections: %s" , err )
57+ }
58+ }
You can’t perform that action at this time.
0 commit comments