(t *testing.T)
| 3 | import "testing" |
| 4 | |
| 5 | func TestSelector(t *testing.T) { |
| 6 | t.Parallel() |
| 7 | |
| 8 | selectorExpectColumnExpr := func(t *testing.T, selector selector, expected, name string, column *Column) { |
| 9 | if actual := selector.ColumnExpr(name, column); expected != actual { |
| 10 | t.Errorf("Expected %v, got %v for data type %v", expected, actual, column.DataType) |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | t.Run("DefaultSelectorColumnExpr", func(t *testing.T) { |
| 15 | t.Parallel() |
| 16 | |
| 17 | selector := newDefaultSelector() |
| 18 | |
| 19 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) |
| 20 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) |
| 21 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "jsonb"}) |
| 22 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) |
| 23 | }) |
| 24 | |
| 25 | t.Run("SQLiteSelectorColumnExpr", func(t *testing.T) { |
| 26 | t.Parallel() |
| 27 | |
| 28 | selector := newSQLiteSelector() |
| 29 | |
| 30 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "integer"}) |
| 31 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "json"}) |
| 32 | selectorExpectColumnExpr(t, selector, "json(my_column)", "my_column", &Column{DataType: "jsonb"}) |
| 33 | selectorExpectColumnExpr(t, selector, "my_column", "my_column", &Column{DataType: "text"}) |
| 34 | }) |
| 35 | } |
nothing calls this directly
no test coverage detected