(t *testing.T, aName, bName string, a, b *parsedFunc)
| 88 | } |
| 89 | |
| 90 | func compareFns(t *testing.T, aName, bName string, a, b *parsedFunc) bool { |
| 91 | if a == nil { |
| 92 | t.Errorf("The function %q is missing", aName) |
| 93 | return false |
| 94 | } |
| 95 | if b == nil { |
| 96 | t.Errorf("The function %q is missing", bName) |
| 97 | return false |
| 98 | } |
| 99 | r := compareArgs(t, "rows.Scan() arguments", aName, bName, a.RowScanArgs, b.RowScanArgs) |
| 100 | if len(a.QueryArgs) > 2 && len(b.QueryArgs) > 2 { |
| 101 | // This is because the actual query param name is different. One uses the |
| 102 | // const, the other uses a variable that is a mutation of the original query. |
| 103 | a.QueryArgs[1] = b.QueryArgs[1] |
| 104 | } |
| 105 | q := compareArgs(t, "db.QueryContext() arguments", aName, bName, a.QueryArgs, b.QueryArgs) |
| 106 | return r && q |
| 107 | } |
| 108 | |
| 109 | func compareArgs(t *testing.T, argType string, aName, bName string, a, b []ast.Expr) bool { |
| 110 | return assert.Equal(t, argList(t, a), argList(t, b), "mismatched %s for %s and %s", argType, aName, bName) |
no test coverage detected