Added paste lang option for pasting programming code.
Expects you to paste only string literals with possible concatenation operators like . or +
This commit is contained in:
parent
35d1e75d35
commit
fbd630489e
8 changed files with 302 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ QT += core widgets
|
|||
HEADERS +=
|
||||
|
||||
SOURCES += main.cpp \
|
||||
tst_ConvertLangToSqlString.cpp \
|
||||
tst_ExplainJsonParser.cpp \
|
||||
tst_expected.cpp \
|
||||
tst_SqlLexer.cpp \
|
||||
|
|
|
|||
63
tests/pglabtests/tst_ConvertLangToSqlString.cpp
Normal file
63
tests/pglabtests/tst_ConvertLangToSqlString.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include "util.h"
|
||||
#include "PrintTo_Qt.h"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
|
||||
TEST(ConvertLangToSqlString, simple)
|
||||
{
|
||||
QString in(R"__( "SELECT" )__");
|
||||
QString expected(R"__(SELECT)__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
TEST(ConvertLangToSqlString, testEscapedQuote)
|
||||
{
|
||||
QString in(R"__( "SELECT\"" )__");
|
||||
QString expected(R"__(SELECT")__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
TEST(ConvertLangToSqlString, testEscapedNewLine)
|
||||
{
|
||||
QString in(R"__( "SELECT\nFROM" )__");
|
||||
QString expected(R"__(SELECT
|
||||
FROM)__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
TEST(ConvertLangToSqlString, testConcatPlus)
|
||||
{
|
||||
QString in(R"__( "SELECT" + " FROM" )__");
|
||||
QString expected(R"__(SELECT FROM)__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
TEST(ConvertLangToSqlString, testConcatDot)
|
||||
{
|
||||
QString in(R"__( "SELECT"." FROM" )__");
|
||||
QString expected(R"__(SELECT FROM)__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
TEST(ConvertLangToSqlString, testSemiColon)
|
||||
{
|
||||
QString in(R"__( "SELECT"." FROM"; )__");
|
||||
QString expected(R"__(SELECT FROM)__");
|
||||
|
||||
auto output = ConvertLangToSqlString(in);
|
||||
ASSERT_EQ(output, expected);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue