mirror of
https://github.com/ascii-boxes/boxes.git
synced 2024-12-04 14:03:53 +01:00
Add more test cases for multiple config files #5
This commit is contained in:
parent
97b62dd09a
commit
749033001f
@ -7,5 +7,6 @@ foo
|
||||
boxes: 120_parser_unterminated_string.cfg: line 4: Unterminated String -- " # unterminated!
|
||||
boxes: 120_parser_unterminated_string.cfg: line 4: syntax error
|
||||
boxes: 120_parser_unterminated_string.cfg: line 4: skipping to next design
|
||||
boxes: 120_parser_unterminated_string.cfg: line 25: no valid designs found
|
||||
boxes: no valid data in config file -- 120_parser_unterminated_string.cfg
|
||||
boxes: no valid designs found
|
||||
:EOF
|
||||
|
15
test/127_data/A.cfg
Normal file
15
test/127_data/A.cfg
Normal file
@ -0,0 +1,15 @@
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file A
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("A")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
36
test/127_data/B.cfg
Normal file
36
test/127_data/B.cfg
Normal file
@ -0,0 +1,36 @@
|
||||
parent 127_data/A.cfg
|
||||
|
||||
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("Ab")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
||||
|
||||
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
B from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("B")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB
|
17
test/127_data/C.cfg
Normal file
17
test/127_data/C.cfg
Normal file
@ -0,0 +1,17 @@
|
||||
parent 127_data/B.cfg
|
||||
|
||||
BOX designC
|
||||
|
||||
sample
|
||||
C from config file C
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("C")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designC
|
34
test/127_multiple_parent_configs.txt
Normal file
34
test/127_multiple_parent_configs.txt
Normal file
@ -0,0 +1,34 @@
|
||||
:DESC
|
||||
A config file that has a "parent" and a "grand-parent".
|
||||
Also test overwriting a design, which leads to designA being from config file 'B.cfg'
|
||||
|
||||
:ARGS
|
||||
-f 127_data/C.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
3 Available Styles:
|
||||
-------------------
|
||||
|
||||
Configuration Files:
|
||||
- 127_data/C.cfg
|
||||
- 127_data/B.cfg (parent)
|
||||
- 127_data/A.cfg (parent)
|
||||
|
||||
|
||||
designA:
|
||||
|
||||
A from config file B
|
||||
|
||||
|
||||
designB:
|
||||
|
||||
B from config file B
|
||||
|
||||
|
||||
designC:
|
||||
|
||||
C from config file C
|
||||
|
||||
|
||||
:EOF
|
19
test/128_data/A.cfg
Normal file
19
test/128_data/A.cfg
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
parent 128_data/B.cfg
|
||||
|
||||
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file A
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("A")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
36
test/128_data/B.cfg
Normal file
36
test/128_data/B.cfg
Normal file
@ -0,0 +1,36 @@
|
||||
parent 128_data/A.cfg
|
||||
|
||||
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("Ab")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
||||
|
||||
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
B from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("B")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB
|
17
test/128_data/C.cfg
Normal file
17
test/128_data/C.cfg
Normal file
@ -0,0 +1,17 @@
|
||||
parent 128_data/B.cfg
|
||||
|
||||
BOX designC
|
||||
|
||||
sample
|
||||
C from config file C
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("C")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designC
|
33
test/128_multiple_parent_configs_cycle.txt
Normal file
33
test/128_multiple_parent_configs_cycle.txt
Normal file
@ -0,0 +1,33 @@
|
||||
:DESC
|
||||
Tests our cycle detection, when parents reference each other.
|
||||
|
||||
:ARGS
|
||||
-f 128_data/C.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
3 Available Styles:
|
||||
-------------------
|
||||
|
||||
Configuration Files:
|
||||
- 128_data/C.cfg
|
||||
- 128_data/B.cfg (parent)
|
||||
- 128_data/A.cfg (parent)
|
||||
|
||||
|
||||
designA:
|
||||
|
||||
A from config file B
|
||||
|
||||
|
||||
designB:
|
||||
|
||||
B from config file B
|
||||
|
||||
|
||||
designC:
|
||||
|
||||
C from config file C
|
||||
|
||||
|
||||
:EOF
|
16
test/129_data/A.cfg
Normal file
16
test/129_data/A.cfg
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file A
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("A")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
33
test/129_data/B.cfg
Normal file
33
test/129_data/B.cfg
Normal file
@ -0,0 +1,33 @@
|
||||
BOX Designa
|
||||
|
||||
sample
|
||||
A from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("Ab")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END Designa
|
||||
|
||||
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
B from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("B")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB
|
16
test/129_data/C.cfg
Normal file
16
test/129_data/C.cfg
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
BOX designC
|
||||
|
||||
sample
|
||||
C from config file C
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("C")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designC
|
5
test/129_data/D.cfg
Normal file
5
test/129_data/D.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
# This file has only parent definitions, but no box designs at all.
|
||||
|
||||
parent 129_data/A.cfg
|
||||
parent 129_data/B.cfg
|
||||
parent 129_data/C.cfg
|
35
test/129_multiple_parent_configs_empty_base.txt
Normal file
35
test/129_multiple_parent_configs_empty_base.txt
Normal file
@ -0,0 +1,35 @@
|
||||
:DESC
|
||||
Config file D has 3 parents, but no design definitions of its own.
|
||||
The order in which parents are evaluated matters! Also, design names are case insensitive.
|
||||
|
||||
:ARGS
|
||||
-f 129_data/D.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
3 Available Styles:
|
||||
-------------------
|
||||
|
||||
Configuration Files:
|
||||
- 129_data/D.cfg
|
||||
- 129_data/C.cfg (parent)
|
||||
- 129_data/B.cfg (parent)
|
||||
- 129_data/A.cfg (parent)
|
||||
|
||||
|
||||
Designa:
|
||||
|
||||
A from config file B
|
||||
|
||||
|
||||
designB:
|
||||
|
||||
B from config file B
|
||||
|
||||
|
||||
designC:
|
||||
|
||||
C from config file C
|
||||
|
||||
|
||||
:EOF
|
16
test/130_data/A.cfg
Normal file
16
test/130_data/A.cfg
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file A
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("AAA", "AAA", "AAA")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
18
test/130_data/B.cfg
Normal file
18
test/130_data/B.cfg
Normal file
@ -0,0 +1,18 @@
|
||||
parent 130_data/A.cfg
|
||||
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
B from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("BBB")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB
|
13
test/130_multiple_parent_configs_inherited_design.txt
Normal file
13
test/130_multiple_parent_configs_inherited_design.txt
Normal file
@ -0,0 +1,13 @@
|
||||
:DESC
|
||||
Reference a design defined in a parent file, so that no match is found after parsing the first file.
|
||||
|
||||
:ARGS
|
||||
-f 130_data/B.cfg -d designA -p l1 -a vc
|
||||
:INPUT
|
||||
foo
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
AAA
|
||||
AAA foo
|
||||
AAA
|
||||
:EOF
|
39
test/131_data/A.cfg
Normal file
39
test/131_data/A.cfg
Normal file
@ -0,0 +1,39 @@
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
B from config file A
|
||||
ends
|
||||
|
||||
# The next line is syntactically fine, but it is NOT a parent reference.
|
||||
parent "131_data/C.cfg"
|
||||
|
||||
shapes {
|
||||
w ("BBB", "BBB", "BBB")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX designB2
|
||||
|
||||
sample
|
||||
B2 from config file A
|
||||
ends
|
||||
|
||||
# The next line is a syntax error, because of missing quotes. Also, this is NOT a parent reference.
|
||||
parent 131_data/C.cfg
|
||||
|
||||
shapes {
|
||||
w ("BB2", "BB2", "BB2")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designB2
|
54
test/131_data/B.cfg
Normal file
54
test/131_data/B.cfg
Normal file
@ -0,0 +1,54 @@
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
A from config file B
|
||||
parent 131_data/C.cfg
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("AAA", "AAA", "AAA")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designA
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX BROKEN
|
||||
|
||||
sample
|
||||
BROKEN from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("BROKEN")
|
||||
}
|
||||
|
||||
# elastic definition is missing
|
||||
|
||||
END BROKEN
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
parent 131_data/A.cfg
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX designC
|
||||
|
||||
sample
|
||||
C from config file B
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("CCC", "CCC", "CCC")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
END designC
|
22
test/131_data/C.cfg
Normal file
22
test/131_data/C.cfg
Normal file
@ -0,0 +1,22 @@
|
||||
# This config file is valid by itself, but should never be referenced.
|
||||
|
||||
BOX designD
|
||||
|
||||
sample
|
||||
D from config file C (ERROR!)
|
||||
ends
|
||||
|
||||
|
||||
shapes {
|
||||
w ("ERROR", "ERROR", "ERROR")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designD
|
40
test/131_multiple_parent_configs_ref_after_broken.txt
Normal file
40
test/131_multiple_parent_configs_ref_after_broken.txt
Normal file
@ -0,0 +1,40 @@
|
||||
:DESC
|
||||
Check that a parent reference works when it is not at the top of a file, but further down.
|
||||
Also check that a parent reference is not evaluated when encountered inside a BOX definition.
|
||||
Also check that a valid parent reference is properly found even when the design right before it is broken. (This means
|
||||
that speedmode is properly terminated.)
|
||||
|
||||
:ARGS
|
||||
-f 131_data/B.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
boxes: 131_data/B.cfg: line 32: entries SAMPLE, SHAPES, and ELASTIC are mandatory
|
||||
boxes: 131_data/B.cfg: line 32: skipping to next design
|
||||
boxes: 131_data/A.cfg: line 29: string expected
|
||||
boxes: 131_data/A.cfg: line 29: skipping to next design
|
||||
3 Available Styles:
|
||||
-------------------
|
||||
|
||||
Configuration Files:
|
||||
- 131_data/B.cfg
|
||||
- 131_data/A.cfg (parent)
|
||||
|
||||
|
||||
designA:
|
||||
|
||||
A from config file B
|
||||
parent 131_data/C.cfg
|
||||
|
||||
|
||||
designB:
|
||||
|
||||
B from config file A
|
||||
|
||||
|
||||
designC:
|
||||
|
||||
C from config file B
|
||||
|
||||
|
||||
:EOF
|
22
test/132_data/A.cfg
Normal file
22
test/132_data/A.cfg
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
BOX designD
|
||||
|
||||
sample
|
||||
DDD
|
||||
DDD foo
|
||||
DDD
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("DDD", "DDD", "DDD")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designD
|
73
test/132_data/B.cfg
Normal file
73
test/132_data/B.cfg
Normal file
@ -0,0 +1,73 @@
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
AAA
|
||||
AAA foo
|
||||
AAA
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("AAA", "AAA", "AAA")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designA
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
BBB
|
||||
BBB foo
|
||||
BBB
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("BBB", "BBB", "BBB")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designB
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
parent 132_data/A.cfg
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX designC
|
||||
|
||||
sample
|
||||
CCC
|
||||
CCC foo
|
||||
CCC
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("CCC", "CCC", "CCC")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designC
|
13
test/132_parent_configs_speedmode.txt
Normal file
13
test/132_parent_configs_speedmode.txt
Normal file
@ -0,0 +1,13 @@
|
||||
:DESC
|
||||
The parent ref is found even while skipping over designs to find the specified one.
|
||||
|
||||
:ARGS
|
||||
-f 132_data/B.cfg -avc -d designD
|
||||
:INPUT
|
||||
foo
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
DDD
|
||||
DDD foo
|
||||
DDD
|
||||
:EOF
|
21
test/133_comments_in_strings.cfg
Normal file
21
test/133_comments_in_strings.cfg
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
BOX design
|
||||
|
||||
sample
|
||||
# looks like a comment - your text here
|
||||
fooooooooooooooooooooo
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("# looks like a comment", "fooooooooooooooooooooo")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END design
|
12
test/133_comments_in_strings.txt
Normal file
12
test/133_comments_in_strings.txt
Normal file
@ -0,0 +1,12 @@
|
||||
:DESC
|
||||
Strings or sample content which looks like a comment must be treated as a string instead (not a comment).
|
||||
|
||||
:ARGS
|
||||
-f 133_comments_in_strings.cfg
|
||||
:INPUT
|
||||
- your text here
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
# looks like a comment - your text here
|
||||
fooooooooooooooooooooo
|
||||
:EOF
|
21
test/134_comments_in_sample.cfg
Normal file
21
test/134_comments_in_sample.cfg
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
BOX design
|
||||
|
||||
sample
|
||||
# looks like a comment - your text here
|
||||
fooooooooooooooooooooo
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("# looks like a comment", "fooooooooooooooooooooo")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END design
|
18
test/134_comments_in_sample.txt
Normal file
18
test/134_comments_in_sample.txt
Normal file
@ -0,0 +1,18 @@
|
||||
:DESC
|
||||
Strings or sample content which looks like a comment must be treated as a string instead (not a comment).
|
||||
|
||||
:ARGS
|
||||
-f 134_comments_in_sample.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
1 Available Style in "134_comments_in_sample.cfg":
|
||||
--------------------------------------------------
|
||||
|
||||
design:
|
||||
|
||||
# looks like a comment - your text here
|
||||
fooooooooooooooooooooo
|
||||
|
||||
|
||||
:EOF
|
50
test/139_parent_config_without_file.cfg
Normal file
50
test/139_parent_config_without_file.cfg
Normal file
@ -0,0 +1,50 @@
|
||||
BOX designA
|
||||
|
||||
sample
|
||||
AAA
|
||||
AAA foo
|
||||
AAA
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("AAA", "AAA", "AAA")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designA
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
# ERROR in following line (missing file name):
|
||||
parent
|
||||
|
||||
# -------------------------------------------------------
|
||||
|
||||
BOX designB
|
||||
|
||||
sample
|
||||
BBB
|
||||
BBB foo
|
||||
BBB
|
||||
ends
|
||||
|
||||
shapes {
|
||||
w ("BBB", "BBB", "BBB")
|
||||
}
|
||||
|
||||
elastic (
|
||||
w
|
||||
)
|
||||
|
||||
padding {
|
||||
left 1
|
||||
}
|
||||
|
||||
END designB
|
28
test/139_parent_config_without_file.txt
Normal file
28
test/139_parent_config_without_file.txt
Normal file
@ -0,0 +1,28 @@
|
||||
:DESC
|
||||
Test that the parser handles gracefully when a broken config file contains just "parent" with no file.
|
||||
|
||||
:ARGS
|
||||
-f 139_parent_config_without_file.cfg -l
|
||||
:INPUT
|
||||
:OUTPUT-FILTER
|
||||
:EXPECTED
|
||||
boxes: 139_parent_config_without_file.cfg: line 30: syntax error
|
||||
boxes: 139_parent_config_without_file.cfg: line 30: skipping to next design
|
||||
2 Available Styles in "139_parent_config_without_file.cfg":
|
||||
-----------------------------------------------------------
|
||||
|
||||
designA:
|
||||
|
||||
AAA
|
||||
AAA foo
|
||||
AAA
|
||||
|
||||
|
||||
designB:
|
||||
|
||||
BBB
|
||||
BBB foo
|
||||
BBB
|
||||
|
||||
|
||||
:EOF
|
Loading…
Reference in New Issue
Block a user