blob: 37f0af6007c227c9b172835244df06e55fca8b18 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# -*- tcl -*-
# pt_rdeengine.test: tests for the pt::rde package.
#
# Copyright (c) 2009 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
# All rights reserved.
#
# RCS: @(#) $Id: pt_rdengine.test,v 1.2 2010/07/27 22:53:53 andreas_kupries Exp $
# -------------------------------------------------------------------------
source [file join \
[file dirname [file dirname [file join [pwd] [info script]]]] \
devtools testutilities.tcl]
testsNeedTcl 8.5
testsNeedTcltest 2.0
support {
useAccel [useTcllibC] struct/stack.tcl struct::stack
TestAccelInit struct::stack
use snit/snit2.tcl snit
useLocal pt_pexpression.tcl pt::pe
useLocal pt_astree.tcl pt::ast
}
testing {
useAccel [useTcllibC] pt/pt_rdengine.tcl pt::rde
TestAccelInit pt::rde
}
#----------------------------------------------------------------------
proc rde_state {r} {
lappend res [list IN [$r chan]]
lappend res [list CC [$r current]]
lappend res [list CL [$r location]]
lappend res [list LS [$r lmarked]]
lappend res [list ST [expr {[$r ok] ? "ok" : "fail"}]]
lappend res [list SV [$r value]]
lappend res [list ER [$r error]]
lappend res [list ES [$r emarked]]
lappend res [list TC [$r tokens]]
lappend res [list NC [dictsort [$r symbols]]]
lappend res [list AR [$r asts]]
lappend res [list AS [$r amarked]]
return "\n [join $res "\n "]"
}
#----------------------------------------------------------------------
snitErrors
TestAccelDo struct::stack stkimpl {
TestAccelDo pt::rde rdeimpl {
switch -exact -- $rdeimpl {
critcl {
set MY myrde
proc tmWrong {m loarg n {xarg {}}} {
return [tcltest::wrongNumArgs "myrde $m" $loarg $n]
}
proc tmTooMany {m loarg {xarg {}}} {
return [tcltest::tooManyArgs "myrde $m" $loarg]
}
proc take {tcl critcl} { return $critcl }
}
tcl {
set MY ::myrde
proc tmWrong {m loarg n {xarg {}}} {
if {$xarg == {}} {set xarg $loarg}
if {$xarg != {}} {set xarg " $xarg"}
incr n
return [tcltest::wrongNumArgs "::pt::rde::$m" "name$xarg" $n]
}
proc tmTooMany {m loarg {xarg {}}} {
if {$xarg == {}} {set xarg $loarg}
if {$xarg != {}} {set xarg " $xarg"}
return [tcltest::tooManyArgs "::pt::rde::$m" "name$xarg"]
}
proc take {tcl critcl} { return $tcl }
}
}
source [localPath tests/pt_rdengine.tests]
}
}
#----------------------------------------------------------------------
TestAccelExit pt::rde
TestAccelExit struct::stack
rename rde_state {}
testsuiteCleanup
|