TestTypesBoolean tests boolean type handling
(t *testing.T)
| 123 | } |
| 124 | runQueryTests(t, tests) |
| 125 | } |
| 126 | |
| 127 | // TestTypesBoolean tests boolean type handling |
| 128 | func TestTypesBoolean(t *testing.T) { |
| 129 | tests := []QueryTest{ |
| 130 | // Literals |
| 131 | {Name: "boolean_true", Query: "SELECT TRUE"}, |
| 132 | {Name: "boolean_false", Query: "SELECT FALSE"}, |
| 133 | |
| 134 | // Cast from string |
| 135 | {Name: "boolean_from_true_string", Query: "SELECT 'true'::BOOLEAN"}, |
| 136 | {Name: "boolean_from_false_string", Query: "SELECT 'false'::BOOLEAN"}, |
| 137 | {Name: "boolean_from_t", Query: "SELECT 't'::BOOLEAN"}, |
| 138 | {Name: "boolean_from_f", Query: "SELECT 'f'::BOOLEAN"}, |
| 139 | {Name: "boolean_from_yes", Query: "SELECT 'yes'::BOOLEAN"}, |
| 140 | {Name: "boolean_from_no", Query: "SELECT 'no'::BOOLEAN"}, |
| 141 | {Name: "boolean_from_1", Query: "SELECT '1'::BOOLEAN"}, |
| 142 | {Name: "boolean_from_0", Query: "SELECT '0'::BOOLEAN"}, |
| 143 | |
| 144 | // Boolean operations |
| 145 | {Name: "boolean_and", Query: "SELECT TRUE AND FALSE"}, |
| 146 | {Name: "boolean_or", Query: "SELECT TRUE OR FALSE"}, |
| 147 | {Name: "boolean_not", Query: "SELECT NOT TRUE"}, |
| 148 | |
| 149 | // From table |
| 150 | {Name: "select_boolean_column", Query: "SELECT bool_col FROM types_test WHERE id = 1"}, |
| 151 | {Name: "filter_by_boolean", Query: "SELECT COUNT(*) FROM users WHERE active = true"}, |
| 152 | } |
| 153 | runQueryTests(t, tests) |
| 154 | } |
nothing calls this directly
no test coverage detected