@@ -75,48 +75,53 @@ function! s:suite.__parse__()
75
75
let multiline_basic_strings = themis#suite (' Multi-line basic strings' )
76
76
77
77
function ! multiline_basic_strings.trims_first_newline ()
78
- let data = s: TOML .parse (join ([
79
- \ ' hoge="""' ,
80
- \ ' One' ,
81
- \ ' Two"""' ,
82
- \] , " \n " ))
83
-
84
- call s: assert .same (data.hoge, " One\n Two" )
78
+ for newline in [" \n " , " \r \n " ]
79
+ let data = s: TOML .parse (join ([
80
+ \ ' str1 = """' ,
81
+ \ ' Roses are red' ,
82
+ \ ' Violets are blue"""' ,
83
+ \] , newline))
84
+
85
+ call s: assert .same (data.str1, join ([
86
+ \ ' Roses are red' ,
87
+ \ ' Violets are blue'
88
+ \] , newline))
89
+ endfor
85
90
endfunction
86
91
87
92
function ! multiline_basic_strings.trims_whitespaces_after_backslash ()
88
- let data = s: TOML .parse (join ([
89
- \ ' hoge= """' ,
90
- \ ' The quick brown \' ,
91
- \ ' ' ,
92
- \ ' ' ,
93
- \ ' fox jumps over \' ,
94
- \ ' the lazy dog."""' ,
95
- \] , " \n " ))
96
-
97
- call s: assert .same (data.hoge, ' The quick brown fox jumps over the lazy dog.' )
98
- endfunction
99
-
100
- function ! multiline_basic_strings.trims_whitespaces_after_backslash2 ()
101
- let data = s: TOML .parse (join ([
102
- \ ' hoge = """\' ,
103
- \ ' The quick brown \' ,
104
- \ ' fox jumps over \' ,
105
- \ ' the lazy dog.\' ,
106
- \ ' """' ,
107
- \] , " \n " ))
108
-
109
- call s: assert .same (data.hoge, ' The quick brown fox jumps over the lazy dog.' )
93
+ for newline in [" \n " , " \r \n " ]
94
+ let data = s: TOML .parse (join ([
95
+ \ ' str2 = """' ,
96
+ \ ' The quick brown \' ,
97
+ \ ' ' ,
98
+ \ ' ' ,
99
+ \ ' fox jumps over \' ,
100
+ \ ' the lazy dog."""' ,
101
+ \ ' str3 = """\' ,
102
+ \ ' The quick brown \' ,
103
+ \ ' fox jumps over \' ,
104
+ \ ' the lazy dog.\' ,
105
+ \ ' """' ,
106
+ \] , newline))
107
+
108
+ call s: assert .same (data.str2, ' The quick brown fox jumps over the lazy dog.' )
109
+ call s: assert .same (data.str3, ' The quick brown fox jumps over the lazy dog.' )
110
+ endfor
110
111
endfunction
111
112
112
113
function ! multiline_basic_strings.includes_escaped_character ()
113
- let data = s: TOML .parse (join ([
114
- \ ' hoge = """\' ,
115
- \ ' delimiter = '' \"""'' \' ,
116
- \ ' """' ,
117
- \] , " \n " ))
118
-
119
- call s: assert .same (data.hoge, ' delimiter = '' """'' ' )
114
+ for newline in [" \n " , " \r \n " ]
115
+ let data = s: TOML .parse (join ([
116
+ \ ' str4 = """Here are two quotation marks: "". Simple enough."""' ,
117
+ \ ' str5 = """Here are three quotation marks: ""\"."""' ,
118
+ \ ' str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""' ,
119
+ \] , newline))
120
+
121
+ call s: assert .same (data.str4, ' Here are two quotation marks: "". Simple enough.' )
122
+ call s: assert .same (data.str5, ' Here are three quotation marks: """.' )
123
+ call s: assert .same (data.str6, ' Here are fifteen quotation marks: """"""""""""""".' )
124
+ endfor
120
125
endfunction
121
126
endfunction
122
127
@@ -135,24 +140,26 @@ function! s:suite.__parse__()
135
140
endfunction
136
141
137
142
function ! parse.multiline_literal_string ()
138
- let data = s: TOML .parse (join ([
139
- \ ' regex2 = '''''' I [dw]on'' t need \d{2} apples'''''' ' ,
140
- \ ' lines = '''''' ' ,
141
- \ ' The first newline is' ,
142
- \ ' trimmed in raw strings.' ,
143
- \ ' All other whitespace' ,
144
- \ ' is preserved.' ,
145
- \ ' ' ' ' ' ' ' ' ,
146
- \] , " \n " ))
147
-
148
- call s: assert .same (data.regex2, ' I [dw]on'' t need \d{2} apples' )
149
- call s: assert .same (data.lines , join ([
150
- \ ' The first newline is' ,
151
- \ ' trimmed in raw strings.' ,
152
- \ ' All other whitespace' ,
153
- \ ' is preserved.' ,
154
- \ ' ' ,
155
- \] , " \n " ))
143
+ for newline in [" \n " , " \r \n " ]
144
+ let data = s: TOML .parse (join ([
145
+ \ ' regex2 = '''''' I [dw]on'' t need \d{2} apples'''''' ' ,
146
+ \ ' lines = '''''' ' ,
147
+ \ ' The first newline is' ,
148
+ \ ' trimmed in raw strings.' ,
149
+ \ ' All other whitespace' ,
150
+ \ ' is preserved.' ,
151
+ \ ' ' ' ' ' ' ' ' ,
152
+ \] , newline))
153
+
154
+ call s: assert .same (data.regex2, ' I [dw]on'' t need \d{2} apples' )
155
+ call s: assert .same (data.lines , join ([
156
+ \ ' The first newline is' ,
157
+ \ ' trimmed in raw strings.' ,
158
+ \ ' All other whitespace' ,
159
+ \ ' is preserved.' ,
160
+ \ ' ' ,
161
+ \] , newline))
162
+ endfor
156
163
endfunction
157
164
158
165
function ! parse.integer ()
0 commit comments