summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-09-21 10:12:39 +0200
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-09-23 07:22:01 +0000
commit8eb30feb033e98719ca48c1e018f4fddb8285a47 (patch)
tree508812e3cbbcf40b4a3a5e99482ddc4f09128f21 /tests
parent7ba22d38d17acef4feb91c714914c3c0d90581cc (diff)
downloadqt-creator-8eb30feb033e98719ca48c1e018f4fddb8285a47.tar.gz
C++: Add basic tests for raw string literals
Change-Id: I9ca253a6a2296912eafe139ce53f4f9779097248 Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/cplusplus/cxx11/data/rawstringliterals.cpp11
-rw-r--r--tests/auto/cplusplus/cxx11/tst_cxx11.cpp1
-rw-r--r--tests/auto/cplusplus/lexer/tst_lexer.cpp11
3 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/cplusplus/cxx11/data/rawstringliterals.cpp b/tests/auto/cplusplus/cxx11/data/rawstringliterals.cpp
new file mode 100644
index 0000000000..d77f4275de
--- /dev/null
+++ b/tests/auto/cplusplus/cxx11/data/rawstringliterals.cpp
@@ -0,0 +1,11 @@
+class String;
+void f()
+{
+ String r1 = R"(raw text)";
+ String r2 = R"(
+raw text line1
+raw text line2
+)";
+ String other;
+}
+
diff --git a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp
index cf8b540f23..0298fb0236 100644
--- a/tests/auto/cplusplus/cxx11/tst_cxx11.cpp
+++ b/tests/auto/cplusplus/cxx11/tst_cxx11.cpp
@@ -198,6 +198,7 @@ void tst_cxx11::parse_data()
QTest::newRow("trailingtypespec.1") << "trailingtypespec.1.cpp" << "";
QTest::newRow("lambda.2") << "lambda.2.cpp" << "";
QTest::newRow("userDefinedLiterals.1") << "userDefinedLiterals.1.cpp" << "";
+ QTest::newRow("rawstringliterals") << "rawstringliterals.cpp" << "";
}
void tst_cxx11::parse()
diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp
index 5622c8097e..fc2b8da047 100644
--- a/tests/auto/cplusplus/lexer/tst_lexer.cpp
+++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp
@@ -335,6 +335,17 @@ void tst_SimpleLexer::literals_data()
<< T_NUMERIC_LITERAL << T_ERROR << T_ERROR << T_ERROR
;
QTest::newRow("integer-literals") << source << expectedTokenKindList;
+
+ source =
+ "R\"(raw text)\"\n"
+ "R\"delimiter(raw text)delimiter\"\n"
+ "R\"delimiter(\nraw text line1\nraw text line2\n)delimiter\"\n"
+ ;
+ expectedTokenKindList =
+ TokenKindList() << T_RAW_STRING_LITERAL << T_RAW_STRING_LITERAL
+ << T_RAW_STRING_LITERAL
+ ;
+ QTest::newRow("raw-string-literals") << source << expectedTokenKindList;
}
void tst_SimpleLexer::preprocessor()