(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestQueryFormatQuery(t *testing.T) { |
| 11 | type FormatModel struct { |
| 12 | Foo string |
| 13 | Bar string |
| 14 | } |
| 15 | |
| 16 | q := NewQuery(nil, &FormatModel{"foo", "bar"}) |
| 17 | |
| 18 | params := &struct { |
| 19 | Foo string |
| 20 | }{ |
| 21 | "not_foo", |
| 22 | } |
| 23 | fmter := NewFormatter().WithModel(q) |
| 24 | b := fmter.FormatQuery(nil, "?foo ?TableName ?TableAlias ?TableColumns ?Columns", params) |
| 25 | |
| 26 | wanted := `'not_foo' "format_models" "format_model" "format_model"."foo", "format_model"."bar" "foo", "bar"` |
| 27 | if string(b) != wanted { |
| 28 | t.Fatalf("got `%s`, wanted `%s`", string(b), wanted) |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | var _ = Describe("NewQuery", func() { |
| 33 | It("works with nil db", func() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…