File: pt_peg_export_json.tests

package info (click to toggle)
tcllib 1.16-dfsg-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 50,040 kB
  • ctags: 18,603
  • sloc: tcl: 156,708; ansic: 14,098; sh: 10,783; xml: 1,766; yacc: 1,114; pascal: 551; makefile: 89; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (39 lines) | stat: -rw-r--r-- 1,402 bytes parent folder | download | duplicates (7)
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
# -*- tcl -*-
# General set of error cases regarding the number of arguments.

test pt-peg-export-json-set:${setimpl}-1.0 {export, wrong#args} -body {
    export
} -returnCodes error -result {wrong # args: should be "export serial configuration"}

test pt-peg-export-json-set:${setimpl}-1.1 {export, wrong#args} -body {
    export S
} -returnCodes error -result {wrong # args: should be "export serial configuration"}

test pt-peg-export-json-set:${setimpl}-1.2 {export, wrong#args} -body {
    export S C XXX
} -returnCodes error -result {wrong # args: should be "export serial configuration"}

# -------------------------------------------------------------------------

# Testing the generation of json output, from grammar serialization,
# for all possible configurations of this plugin.

foreach {k in al section} {
    0 0 0 -ultracompact
    1 1 0 -indented
    2 0 1 -indalign
    3 1 1 -indalign
} {
    TestFilesProcess $mytestdir ok peg_serial-canonical peg_json$section -> n label input data expected {
	test pt-peg-export-json-set:${setimpl}-2.$k.$n "pt::peg::export::json, $label$section, ok :- $input" -setup {
	    set configuration [list -indented $in -aligned $al]
	} -body {
	    export $data $configuration
	} -cleanup {
	    unset configuration
	} -result $expected
    }
}

#----------------------------------------------------------------------
unset n label input data expected