Add tests for tag handling #23

This commit is contained in:
Thomas Jensen 2021-04-04 15:05:39 +02:00
parent 542e6bd4dd
commit f93639f1e4
No known key found for this signature in database
GPG Key ID: A4ACEE270D0FB7DB
14 changed files with 344 additions and 0 deletions

View File

@ -0,0 +1,12 @@
:ARGS
-f 14x_tag_query.cfg -l -q tag1,tag2
:INPUT
:OUTPUT-FILTER
:EXPECTED
designA
aliasA1 (alias)
designB
aliasB1 (alias)
aliasB2 (alias)
designC
:EOF

View File

@ -0,0 +1,9 @@
:ARGS
-f 14x_tag_query.cfg -l -q +tag1,tag2
:INPUT
:OUTPUT-FILTER
:EXPECTED
designA
aliasA1 (alias)
designC
:EOF

View File

@ -0,0 +1,8 @@
:ARGS
-f 14x_tag_query.cfg -l -q +tag1,+tag3
:INPUT
:OUTPUT-FILTER
:EXPECTED
designA
aliasA1 (alias)
:EOF

View File

@ -0,0 +1,10 @@
:ARGS
-f 14x_tag_query.cfg -l -q -tag1
:INPUT
:OUTPUT-FILTER
:EXPECTED
designB
aliasB1 (alias)
aliasB2 (alias)
designD
:EOF

View File

@ -0,0 +1,7 @@
:ARGS
-f 14x_tag_query.cfg -l -q -tag1,-tag2
:INPUT
:OUTPUT-FILTER
:EXPECTED
designD
:EOF

View File

@ -0,0 +1,13 @@
:ARGS
-f 14x_tag_query.cfg -l -q (all)
:INPUT
:OUTPUT-FILTER
:EXPECTED
designA
aliasA1 (alias)
designB
aliasB1 (alias)
aliasB2 (alias)
designC
designD
:EOF

View File

@ -0,0 +1,7 @@
:ARGS
-f 146_tag_query.cfg -l -q INVALID
:INPUT
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: not a tag -- INVALID
:EOF

View File

@ -0,0 +1,38 @@
:ARGS
-f 14x_tag_query.cfg -l
:INPUT
:OUTPUT-FILTER
:EXPECTED
4 Available Styles in "14x_tag_query.cfg":
------------------------------------------
designA alias aliasA1:
AAA
AAA foo
AAA
designB alias aliasB1, aliasB2:
BBB
BBB foo
BBB
designC:
CCC
CCC foo
CCC
designD:
DDD
DDD foo
DDD
tag1 (2) | tag2 (3) | tag3 (3)
:EOF

View File

@ -0,0 +1,7 @@
:ARGS
-f 14x_tag_query.cfg -l -q -tag1,+tag1
:INPUT
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: duplicate query expression -- +tag1
:EOF

View File

@ -0,0 +1,7 @@
:ARGS
-f 14x_tag_query.cfg -l -q -tag1,tag1
:INPUT
:OUTPUT-FILTER
:EXPECTED-ERROR 1
boxes: duplicate query expression -- tag1
:EOF

103
test/14x_tag_query.cfg Normal file
View File

@ -0,0 +1,103 @@
BOX designA, aliasA1
tags ("tag1", "tag2", "tag3")
sample
AAA
AAA foo
AAA
ends
shapes {
w ("AAA", "AAA", "AAA")
}
elastic (
w
)
padding {
left 1
}
END designA
# -------------------------------------------------------
BOX designB, aliasB1, aliasB2
tags ("tag2 ",
" tag3")
sample
BBB
BBB foo
BBB
ends
shapes {
w ("BBB", "BBB", "BBB")
}
elastic (
w
)
padding {
left 1
}
END designB
# -------------------------------------------------------
BOX designC
tags (" tag1 ",
"tag2 ")
sample
CCC
CCC foo
CCC
ends
shapes {
w ("CCC", "CCC", "CCC")
}
elastic (
w
)
padding {
left 1
}
END designC
# -------------------------------------------------------
BOX designD
tags "tag3"
sample
DDD
DDD foo
DDD
ends
shapes {
w ("DDD", "DDD", "DDD")
}
elastic (
w
)
padding {
left 1
}
END designD

View File

@ -0,0 +1,79 @@
BOX designA
tags ("tag1")
tags ("tag2", "tag3")
tags "tag4 , tag5"
tags "tag6"
sample
AAA
AAA foo
AAA
ends
shapes {
w ("AAA", "AAA", "AAA")
}
elastic (
w
)
padding {
left 1
}
END designA
# -------------------------------------------------------
BOX designB
tags "Invalid1, 2invalid, invalid3-, -invalid4, in--valid5"
tags ("in space valid6")
sample
BBB
BBB foo
BBB
ends
shapes {
w ("BBB", "BBB", "BBB")
}
elastic (
w
)
padding {
left 1
}
END designB
# -------------------------------------------------------
BOX designC
tags ("in space valid7")
sample
CCC
CCC foo
CCC
ends
shapes {
w ("CCC", "CCC", "CCC")
}
elastic (
w
)
padding {
left 1
}
END designC

View File

@ -0,0 +1,38 @@
:ARGS
-f 150_tag_config_invalid_tags.cfg -l
:INPUT
:OUTPUT-FILTER
:EXPECTED
boxes: 150_tag_config_invalid_tags.cfg: line 32: invalid tag -- Invalid1
boxes: 150_tag_config_invalid_tags.cfg: line 32: invalid tag -- 2invalid
boxes: 150_tag_config_invalid_tags.cfg: line 32: invalid tag -- invalid3-
boxes: 150_tag_config_invalid_tags.cfg: line 32: invalid tag -- -invalid4
boxes: 150_tag_config_invalid_tags.cfg: line 32: invalid tag -- in--valid5
boxes: 150_tag_config_invalid_tags.cfg: line 33: invalid tag -- in space valid6
boxes: 150_tag_config_invalid_tags.cfg: line 59: invalid tag -- in space valid7
3 Available Styles in "150_tag_config_invalid_tags.cfg":
--------------------------------------------------------
designA:
AAA
AAA foo
AAA
designB:
BBB
BBB foo
BBB
designC:
CCC
CCC foo
CCC
tag1 (1) | tag2 (1) | tag3 (1) | tag4 (1) | tag5 (1) | tag6 (1)
:EOF

View File

@ -0,0 +1,6 @@
:ARGS
-f 14x_tag_query.cfg -l -q non-existent
:INPUT
:OUTPUT-FILTER
:EXPECTED
:EOF