forked from willbryant/kitchen_sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql_functions_test.cpp
More file actions
21 lines (18 loc) · 1011 Bytes
/
sql_functions_test.cpp
File metadata and controls
21 lines (18 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "../../catch2/catch.hpp"
#include "../src/sql_functions.h"
TEST_CASE("quote_identifier", "[sql_functions]") {
REQUIRE(quote_identifier("foo", '`') == "`foo`");
REQUIRE(quote_identifier("foo_bar", '`') == "`foo_bar`");
REQUIRE(quote_identifier("foo_`bar", '`') == "`foo_``bar`");
REQUIRE(quote_identifier("foo_``bar", '`') == "`foo_````bar`");
REQUIRE(quote_identifier("foo_`b`ar", '`') == "`foo_``b``ar`");
REQUIRE(quote_identifier("`foo_bar", '`') == "```foo_bar`");
REQUIRE(quote_identifier("foo_bar`", '`') == "`foo_bar```");
REQUIRE(quote_identifier("foo", '"') == "\"foo\"");
REQUIRE(quote_identifier("foo_bar", '"') == "\"foo_bar\"");
REQUIRE(quote_identifier("foo_\"bar", '"') == "\"foo_\"\"bar\"");
REQUIRE(quote_identifier("foo_\"\"bar", '"') == "\"foo_\"\"\"\"bar\"");
REQUIRE(quote_identifier("foo_\"b\"ar", '"') == "\"foo_\"\"b\"\"ar\"");
REQUIRE(quote_identifier("\"foo_bar", '"') == "\"\"\"foo_bar\"");
REQUIRE(quote_identifier("foo_bar\"", '"') == "\"foo_bar\"\"\"");
}