File: pt_parse_peg.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 (36 lines) | stat: -rw-r--r-- 1,103 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
# -*- tcl -*-
# General set of error cases regarding the number of arguments.

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

# Testing the processing of PEG input in various forms.

foreach {k section} {
    0 {}
    1 -fused
    2 -templated
    3 -templated-fused
} {
    TestFilesProcess $mytestdir ok peg_peg$section peg_peg-ast$section -> n label input data expected {
	test pt-parse-peg-parse:${parseimpl}-rde:${rdeimpl}-stack:${stackimpl}-2.$k.$n "pt::parse::peg /text, $label$section, ok :- $input" -setup {
	    set p [pt::parse::peg]
	} -body {
	    pt::ast print [$p parset $data]
	} -cleanup {
	    $p destroy
	} -result $expected

	test pt-parse-peg-parse:${parseimpl}-rde:${rdeimpl}-stack:${stackimpl}-3.$k.$n "pt::parse::peg /file, $label$section, ok :- $input" -setup {
	    set p [pt::parse::peg]
	    set chan [open $input]
	} -body {
	    pt::ast print [$p parse $chan]
	} -cleanup {
	    close $chan
	    $p destroy
	} -result $expected
    }
}

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