/
string_feature.test
90 lines (82 loc) · 1.86 KB
/
string_feature.test
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
""
"fo\"obar"
"""fo"o
bar"""
"""fo"o
// comment
bar"""
"""{"name":"James"}"""
"foo /* comment */ bar"
s"Hello, $name"
s"1 + 1 = ${1 + 1}"
s"New offers starting at $$14.99"
f"$name%s is $height%2.2f meters tall"
json"{ name: $name, id: $id }"
----------------------------------------------------
[
["string", "\"\""],
["string", "\"fo\\\"obar\""],
["triple-quoted-string", "\"\"\"fo\"o\r\nbar\"\"\""],
["triple-quoted-string", "\"\"\"fo\"o\r\n// comment\r\nbar\"\"\""],
["triple-quoted-string", "\"\"\"{\"name\":\"James\"}\"\"\""],
["string", "\"foo /* comment */ bar\""],
["string-interpolation", [
["id", "s"],
["string", "\"Hello, "],
["interpolation", [
["punctuation", "$"],
["expression", ["name"]]
]],
["string", "\""]
]],
["string-interpolation", [
["id", "s"],
["string", "\"1 + 1 = "],
["interpolation", [
["punctuation", "${"],
["expression", [
["number", "1"],
["operator", "+"],
["number", "1"]
]],
["punctuation", "}"]
]],
["string", "\""]
]],
["string-interpolation", [
["id", "s"],
["string", "\"New offers starting at "],
["escape", "$$"],
["string", "14.99\""]
]],
["string-interpolation", [
["id", "f"],
["string", "\""],
["interpolation", [
["punctuation", "$"],
["expression", ["name"]]
]],
["string", "%s is "],
["interpolation", [
["punctuation", "$"],
["expression", ["height"]]
]],
["string", "%2.2f meters tall\""]
]],
["string-interpolation", [
["id", "json"],
["string", "\"{ name: "],
["interpolation", [
["punctuation", "$"],
["expression", ["name"]]
]],
["string", ", id: "],
["interpolation", [
["punctuation", "$"],
["expression", ["id"]]
]],
["string", " }\""]
]]
]
----------------------------------------------------
Checks for strings.