@@ -148,48 +148,57 @@ function! s:suite.__parse__()
148148 let multiline_basic_strings = themis#suite (' Multi-line basic strings' )
149149
150150 function ! multiline_basic_strings.trims_first_newline ()
151- let data = s: TOML .parse (join ([
152- \ ' str1 = """' ,
153- \ ' Roses are red' ,
154- \ ' Violets are blue"""' ,
155- \] , " \n " ))
156-
157- call s: assert .same (data.str1, " Roses are red\n Violets are blue" )
151+ for newline in [" \n " , " \r \n " ]
152+ let data = s: TOML .parse (join ([
153+ \ ' str1 = """' ,
154+ \ ' Roses are red' ,
155+ \ ' Violets are blue"""' ,
156+ \] , newline))
157+
158+ call s: assert .same (data.str1, join ([
159+ \ ' Roses are red' ,
160+ \ ' Violets are blue'
161+ \] , newline))
162+ endfor
158163 endfunction
159164
160165 function ! multiline_basic_strings.trims_whitespaces_after_backslash ()
161- let data = s: TOML .parse (join ([
162- \ ' str2 = """' ,
163- \ ' The quick brown \' ,
164- \ ' ' ,
165- \ ' ' ,
166- \ ' fox jumps over \' ,
167- \ ' the lazy dog."""' ,
168- \ ' str3 = """\' ,
169- \ ' The quick brown \' ,
170- \ ' fox jumps over \' ,
171- \ ' the lazy dog.\' ,
172- \ ' """' ,
173- \] , " \n " ))
174-
175- call s: assert .same (data.str2, ' The quick brown fox jumps over the lazy dog.' )
176- call s: assert .same (data.str3, ' The quick brown fox jumps over the lazy dog.' )
166+ for newline in [" \n " , " \r \n " ]
167+ let data = s: TOML .parse (join ([
168+ \ ' str2 = """' ,
169+ \ ' The quick brown \' ,
170+ \ ' ' ,
171+ \ ' ' ,
172+ \ ' fox jumps over \' ,
173+ \ ' the lazy dog."""' ,
174+ \ ' str3 = """\' ,
175+ \ ' The quick brown \' ,
176+ \ ' fox jumps over \' ,
177+ \ ' the lazy dog.\' ,
178+ \ ' """' ,
179+ \] , newline))
180+
181+ call s: assert .same (data.str2, ' The quick brown fox jumps over the lazy dog.' )
182+ call s: assert .same (data.str3, ' The quick brown fox jumps over the lazy dog.' )
183+ endfor
177184 endfunction
178185
179186 function ! multiline_basic_strings.includes_escaped_character ()
180- let data = s: TOML .parse (join ([
181- \ ' str4 = """Here are two quotation marks: "". Simple enough."""' ,
182- \ ' str5 = """Here are three quotation marks: ""\"."""' ,
183- \ ' str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""' ,
184- \ ' ' ,
185- \ ' # "This," she said, "is just a pointless statement."' ,
186- \ ' str7 = """"This," she said, "is just a pointless statement.""""' ,
187- \] , " \n " ))
188-
189- call s: assert .same (data.str4, ' Here are two quotation marks: "". Simple enough.' )
190- call s: assert .same (data.str5, ' Here are three quotation marks: """.' )
191- call s: assert .same (data.str6, ' Here are fifteen quotation marks: """"""""""""""".' )
192- call s: assert .same (data.str7, ' "This," she said, "is just a pointless statement."' )
187+ for newline in [" \n " , " \r \n " ]
188+ let data = s: TOML .parse (join ([
189+ \ ' str4 = """Here are two quotation marks: "". Simple enough."""' ,
190+ \ ' str5 = """Here are three quotation marks: ""\"."""' ,
191+ \ ' str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""' ,
192+ \ ' ' ,
193+ \ ' # "This," she said, "is just a pointless statement."' ,
194+ \ ' str7 = """"This," she said, "is just a pointless statement.""""' ,
195+ \] , newline))
196+
197+ call s: assert .same (data.str4, ' Here are two quotation marks: "". Simple enough.' )
198+ call s: assert .same (data.str5, ' Here are three quotation marks: """.' )
199+ call s: assert .same (data.str6, ' Here are fifteen quotation marks: """"""""""""""".' )
200+ call s: assert .same (data.str7, ' "This," she said, "is just a pointless statement."' )
201+ endfor
193202 endfunction
194203 endfunction
195204
@@ -208,31 +217,33 @@ function! s:suite.__parse__()
208217 endfunction
209218
210219 function ! parse.multiline_literal_string ()
211- let data = s: TOML .parse (join ([
212- \ ' regex2 = '''''' I [dw]on'' t need \d{2} apples'''''' ' ,
213- \ ' lines = '''''' ' ,
214- \ ' The first newline is' ,
215- \ ' trimmed in raw strings.' ,
216- \ ' All other whitespace' ,
217- \ ' is preserved.' ,
218- \ ' ' ' ' ' ' ' ' ,
219- \ ' ' ,
220- \ ' quot15 = '''''' Here fifteen quotation marks: """""""""""""""'''''' ' ,
221- \ ' ' ,
222- \ " # 'That's still pointless', she said." ,
223- \ " str = ''''That's still pointless', she said.'''" ,
224- \] , " \n " ))
225-
226- call s: assert .same (data.regex2, ' I [dw]on'' t need \d{2} apples' )
227- call s: assert .same (data.lines , join ([
228- \ ' The first newline is' ,
229- \ ' trimmed in raw strings.' ,
230- \ ' All other whitespace' ,
231- \ ' is preserved.' ,
232- \ ' ' ,
233- \] , " \n " ))
234- call s: assert .same (data.quot15, ' Here fifteen quotation marks: """""""""""""""' )
235- call s: assert .same (data.str, ' ' ' That'' s still pointless'' , she said.' )
220+ for newline in [" \n " , " \r \n " ]
221+ let data = s: TOML .parse (join ([
222+ \ ' regex2 = '''''' I [dw]on'' t need \d{2} apples'''''' ' ,
223+ \ ' lines = '''''' ' ,
224+ \ ' The first newline is' ,
225+ \ ' trimmed in raw strings.' ,
226+ \ ' All other whitespace' ,
227+ \ ' is preserved.' ,
228+ \ ' ' ' ' ' ' ' ' ,
229+ \ ' ' ,
230+ \ ' quot15 = '''''' Here fifteen quotation marks: """""""""""""""'''''' ' ,
231+ \ ' ' ,
232+ \ " # 'That's still pointless', she said." ,
233+ \ " str = ''''That's still pointless', she said.'''" ,
234+ \] , newline))
235+
236+ call s: assert .same (data.regex2, ' I [dw]on'' t need \d{2} apples' )
237+ call s: assert .same (data.lines , join ([
238+ \ ' The first newline is' ,
239+ \ ' trimmed in raw strings.' ,
240+ \ ' All other whitespace' ,
241+ \ ' is preserved.' ,
242+ \ ' ' ,
243+ \] , newline))
244+ call s: assert .same (data.quot15, ' Here fifteen quotation marks: """""""""""""""' )
245+ call s: assert .same (data.str, ' ' ' That'' s still pointless'' , she said.' )
246+ endfor
236247 endfunction
237248
238249 function ! parse.__integer__ ()
0 commit comments