diff options
Diffstat (limited to 'libdbpp/unittests')
-rw-r--r-- | libdbpp/unittests/parseTest.sql | 9 | ||||
-rw-r--r-- | libdbpp/unittests/testParse.cpp | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/libdbpp/unittests/parseTest.sql b/libdbpp/unittests/parseTest.sql index 6a3df82..5e1fbcd 100644 --- a/libdbpp/unittests/parseTest.sql +++ b/libdbpp/unittests/parseTest.sql @@ -4,6 +4,15 @@ CREATE TABLE name ( primary key(i) ); -- Single line comment +-- + -- + -- +-- + +/* Comment */ + /**/ + /* */ + /**/ INSERT INTO name(t, i) VALUES('string', 3); /* Multi line diff --git a/libdbpp/unittests/testParse.cpp b/libdbpp/unittests/testParse.cpp index 093cc7d..b5f3d65 100644 --- a/libdbpp/unittests/testParse.cpp +++ b/libdbpp/unittests/testParse.cpp @@ -56,6 +56,22 @@ BOOST_AUTO_TEST_CASE( parse ) p.Execute(); BOOST_REQUIRE_EQUAL(p.executed.size(), 3); BOOST_REQUIRE_EQUAL(p.executed[1], "INSERT INTO name(t, i) VALUES('string', 3)"); + auto cs = { + "Single line comment", + "", + "", + "", + "", + "Comment", + "", + "", + "", + "Multi line\n\t comment", + "! Stupid MySQL terminates", + "! comments with a ;", + "! Because reasons", + }; + BOOST_CHECK_EQUAL_COLLECTIONS(p.comments.begin(), p.comments.end(), cs.begin(), cs.end()); } BOOST_AUTO_TEST_CASE( parseDollarQuote ) |