Skip to content

Commit 1e9bf6b

Browse files
committed
Refactor tests
1 parent e5ebab6 commit 1e9bf6b

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

test/runtests.jl

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,50 @@ end
3232

3333
@testset "BlockScalars.jl" begin
3434
@testset "block: $test" for (test, str) in TEST_STRINGS
35+
expected_lk = yaml_block(str, "|+")
36+
expected_lc = yaml_block(str, "|")
37+
expected_ls = yaml_block(str, "|-")
38+
39+
expected_fk = yaml_block(str, ">+")
40+
expected_fc = yaml_block(str, ">")
41+
expected_fs = yaml_block(str, ">-")
42+
3543
@testset "literal" begin
36-
@test block(str, :literal, :keep) == yaml_block(str, "|+")
37-
@test block(str, :literal, :clip) == yaml_block(str, "|")
38-
@test block(str, :literal, :strip) == yaml_block(str, "|-")
44+
@test block(str, :literal, :keep) == expected_lk
45+
@test block(str, :literal, :clip) == expected_lc
46+
@test block(str, :literal, :strip) == expected_ls
47+
48+
@test block(str, style=:literal, chomp=:keep) == expected_lk
49+
@test block(str, style=:literal, chomp=:clip) == expected_lc
50+
@test block(str, style=:literal, chomp=:strip) == expected_ls
3951
end
4052

4153
@testset "folding" begin
42-
@test block(str, :folded, :keep) == yaml_block(str, ">+")
43-
@test block(str, :folded, :clip) == yaml_block(str, ">")
44-
@test block(str, :folded, :strip) == yaml_block(str, ">-")
54+
@test block(str, :folded, :keep) == expected_fk
55+
@test block(str, :folded, :clip) == expected_fc
56+
@test block(str, :folded, :strip) == expected_fs
57+
58+
@test block(str, style=:folded, chomp=:keep) == expected_fk
59+
@test block(str, style=:folded, chomp=:clip) == expected_fc
60+
@test block(str, style=:folded, chomp=:strip) == expected_fs
4561
end
4662

4763
@testset "default chomp" begin
48-
@test block(str, :literal) == yaml_block(str, "|-")
49-
@test block(str, :folded) == yaml_block(str, ">-")
64+
@test block(str, :literal) == expected_ls
65+
@test block(str, :folded) == expected_fs
66+
67+
@test block(str, style=:literal) == expected_ls
68+
@test block(str, style=:folded) == expected_fs
5069
end
5170

5271
@testset "default style" begin
53-
@test block(str, chomp=:keep) == yaml_block(str, ">+")
54-
@test block(str, chomp=:clip) == yaml_block(str, ">")
55-
@test block(str, chomp=:strip) == yaml_block(str, ">-")
72+
@test block(str, chomp=:keep) == expected_fk
73+
@test block(str, chomp=:clip) == expected_fc
74+
@test block(str, chomp=:strip) == expected_fs
5675
end
5776

58-
@testset "default" begin
59-
@test block(str) == yaml_block(str, ">-")
77+
@testset "default style/chomp" begin
78+
@test block(str) == expected_fs
6079
end
6180
end
6281

0 commit comments

Comments
 (0)