@@ -10,25 +10,28 @@ function yaml_block(str, block_scalar)
10
10
end
11
11
12
12
# https://yaml-multiline.info/
13
- const TEXT = """
14
- Several lines of text,
15
- with some "quotes" of various 'types'
16
- and also two blank lines:
13
+ const TEST_STRINGS = [
14
+ " paragraph" => """
15
+ Several lines of text,
16
+ with some "quotes" of various 'types'
17
+ and also two blank lines:
17
18
18
19
19
- plus another line at the end.
20
+ plus another line at the end.
20
21
21
22
22
- """
23
-
24
- const WHITESPACE = " a\n b\n c \n d\n "
23
+ """ ,
24
+ " whitespace" => " a\n b\n c \n d\n " ,
25
+ " no ending newline" => " foo" ,
26
+ ]
25
27
26
28
# Validate `yaml_block` function
27
- @assert yaml_block (TEXT, " |+" ) == TEXT
28
- @assert yaml_block (TEXT, " |+" ) == TEXT
29
+ for (test, str) in TEST_STRINGS
30
+ @assert yaml_block (str, " |+" ) == str
31
+ end
29
32
30
33
@testset " BlockScalars.jl" begin
31
- @testset " block: $name " for (name , str) in ( " TEXT " => TEXT, " WHITESPACE " => WHITESPACE)
34
+ @testset " block: $test " for (test , str) in TEST_STRINGS
32
35
@testset " literal" begin
33
36
@test block (str, " lk" ) == yaml_block (str, " |+" )
34
37
@test block (str, " lc" ) == yaml_block (str, " |" )
0 commit comments