File: action.test

package info (click to toggle)
mmucl 1.5.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 648 kB
  • ctags: 303
  • sloc: tcl: 4,977; sh: 111; makefile: 97
file content (71 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (2)
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
# -*-tcl-*-

# set

foreach type {format regexp exact} {
    action set -$type a b
    action set -$type -priority 1 -- a b

    if {[action type a] ne $type} {
	error "type failed in set"
    }
    
    if {[action set a] ne "b"} {
	error "set failed"
    }
}

# names

if {[string length [action names a]] == 0} {
    error "names failed"
}

if {[lsearch -exact [action names] a] == -1} {
    error "names didn't return everything"
}

# priority

action priority a
action priority a 10

# match

if  {[lsearch -exact [action match a] a] == -1} {
     error "action didn't match string"
} 
 
# delete
 
action delete -- a
action delete -exact -- a

if {![catch {action set a}]} {
    error "delete failed"
}

action delete *

if {[llength [action names]]} {
    error "delete failed"
}

# state

action set a b
set state [action state]
action delete *

eval $state

if {[lsearch -exact [action names] a] == -1} {
    error "state wasn't saved correctly"
}

action delete *

# print

action print
action print pattern