TestEmptyQuery tests that empty queries return EmptyQueryResponse, not an error.
(t *testing.T)
| 44 | |
| 45 | // TestEmptyQuery tests that empty queries return EmptyQueryResponse, not an error. |
| 46 | func TestEmptyQuery(t *testing.T) { |
| 47 | tests := []struct { |
| 48 | name string |
| 49 | query string |
| 50 | }{ |
| 51 | {"semicolon", ";"}, |
| 52 | {"semicolon_newline", ";\n"}, |
| 53 | {"multiple_semicolons", ";;;"}, |
| 54 | {"whitespace_semicolons", " ; ; "}, |
| 55 | {"empty_string", ""}, |
| 56 | } |
| 57 | |
| 58 | for _, tt := range tests { |
| 59 | t.Run(tt.name, func(t *testing.T) { |
| 60 | _, err := testHarness.DuckgresDB.Exec(tt.query) |
| 61 | if err != nil { |
| 62 | t.Errorf("Empty query %q should not return an error, got: %v", tt.query, err) |
| 63 | } |
| 64 | }) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // TestProtocolSimpleQuery tests the simple query protocol |
| 69 | func TestProtocolSimpleQuery(t *testing.T) { |