blob: e8e8b6b7ae1af136e0e9cf888d5188571b0b76cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# file : unit-tests/cc/lexer/raw-string-literal.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
# Test raw string literals.
#
: normal
:
$* <<EOI >>EOO
R"()"
R"(ab)"
R"(a"b)"
R"(a)b)"
R"%(a%)b)%"
R"X(a
b)X"
R"X(a\
b)X"
EOI
<string literal>
<string literal>
<string literal>
<string literal>
<string literal>
<string literal>
<string literal>
EOO
: prefix
:
$* <<EOI >>EOO
LR"(ab)"
UR"(ab)"
uR"(ab)"
u8R"(ab)"
EOI
<string literal>
<string literal>
<string literal>
<string literal>
EOO
: suffix
:
$* <<EOI >>EOO
R"(ab)"x
R"(ab)"_X123
EOI
<string literal>
<string literal>
EOO
: escape
:
$* <<EOI >>EOO
R"(\)"
EOI
<string literal>
EOO
: invalid-no-paren
:
$* <'R"a"' 2>>EOE != 0
stdin:1:2: error: invalid raw literal
EOE
: invalid-paren
:
$* <'R")()("' 2>>EOE != 0
stdin:1:2: error: invalid raw literal
EOE
: invalid-unterminated-paren
:
$* <'R"(abc"' 2>>EOE != 0
stdin:1:2: error: invalid raw literal
EOE
: invalid-unterminated-delimiter
:
$* <'R"X(abc)"' 2>>EOE != 0
stdin:1:2: error: invalid raw literal
EOE
: invalid-unterminated-quote
:
$* <'R"X(abc)X' 2>>EOE != 0
stdin:1:2: error: invalid raw literal
EOE
|