1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
# -*- tcl -*-
# General set of error cases regarding the number of arguments.
test pt-peg-to-param-1.0 {convert, wrong#args} -body {
pt::peg::to::param convert
} -returnCodes error -result {wrong # args: should be "pt::peg::to::param convert serial"}
test pt-peg-to-param-1.1 {convert, wrong#args} -body {
pt::peg::to::param convert S XXX
} -returnCodes error -result {wrong # args: should be "pt::peg::to::param convert serial"}
test pt-peg-to-param-2.0 {reset, wrong#args} -body {
pt::peg::to::param reset XXX
} -returnCodes error -result {wrong # args: should be "pt::peg::to::param reset"}
# -------------------------------------------------------------------------
# TODO :: Tests missing for: configure/cget, reset
# -------------------------------------------------------------------------
# Testing the generation of peg output, from grammar serialization,
# for all possible configurations of this plugin.
foreach {k c i section} {
0 1 1 {}
1 1 0 -compact
2 0 1 -inlined
3 0 0 -unopt
} {
TestFilesProcess $mytestdir ok peg_serial-canonical peg_param$section -> n label input data expected {
test pt-peg-to-param-3.$k.$n "pt::peg::to::param, $label$section, ok :- $input" -setup {
text::write reset
text::write field # -*- text -*- ; text::write /line
text::write field # Parsing Expression Grammar '@name@'. ; text::write /line
text::write field # Generated for @user@, from file '@file@' ; text::write /line
text::write /line
text::write field @code@ ; text::write /line
text::write /line
text::write field # ; text::write /line
text::write field # ; text::write /line
pt::peg::to::param reset
pt::peg::to::param configure -name TEMPLATE
pt::peg::to::param configure -file TEST
pt::peg::to::param configure -template [text::write get]
pt::peg::to::param configure -inline $i
pt::peg::to::param configure -compact $c
text::write reset
} -body {
pt::peg::to::param convert $data
} -cleanup {
pt::peg::to::param reset
} -result $expected
}
}
#----------------------------------------------------------------------
unset n label input data expected
|