You've already forked go-sqlxmock
							
							
				mirror of
				https://github.com/zhashkevych/go-sqlxmock.git
				synced 2025-10-30 23:27:38 +02:00 
			
		
		
		
	added tests
This commit is contained in:
		| @@ -99,3 +99,20 @@ func TestQueryExpectationArgComparisonBool(t *testing.T) { | ||||
| 		t.Error("arguments should not match, since argument is different") | ||||
| 	} | ||||
| } | ||||
|  | ||||
| type panicConverter struct { | ||||
| } | ||||
|  | ||||
| func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) { | ||||
| 	panic(v) | ||||
| } | ||||
|  | ||||
| func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) { | ||||
| 	e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}} | ||||
| 	values := []namedValue{ | ||||
| 		{Ordinal: 1, Name: "test", Value: "test"}, | ||||
| 	} | ||||
| 	if err := e.attemptArgMatch(values); err == nil { | ||||
| 		t.Errorf("error expected") | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -155,3 +155,20 @@ func TestQueryExpectationNamedArgComparison(t *testing.T) { | ||||
| 		t.Errorf("arguments should have matched, but it did not: %v", err) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| type panicConverter struct { | ||||
| } | ||||
|  | ||||
| func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) { | ||||
| 	panic(v) | ||||
| } | ||||
|  | ||||
| func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) { | ||||
| 	e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}} | ||||
| 	values := []driver.NamedValue{ | ||||
| 		{Ordinal: 1, Name: "test", Value: "test"}, | ||||
| 	} | ||||
| 	if err := e.attemptArgMatch(values); err == nil { | ||||
| 		t.Errorf("error expected") | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user