File: exists.test

package info (click to toggle)
openocd 0.9.0-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 24,876 kB
  • sloc: ansic: 275,029; sh: 15,664; tcl: 7,079; asm: 1,913; cpp: 1,671; makefile: 1,200; perl: 717; python: 708; haskell: 35
file content (79 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download | duplicates (12)
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
source [file dirname [info script]]/testing.tcl

needs cmd exists
testConstraint lambda [expr {[info commands lambda] ne {}}]

test exists-1.1 "Exists var" {
	set a 1
	exists a
} 1

test exists-1.1 "Exists var" {
	unset -nocomplain b
	exists b
} 0

test exists-1.1 "Exists -var" {
	exists -var a
} 1

test exists-1.1 "Exists -var" {
	exists -var b
} 0

test exists-1.1 "Exists in proc" {
	proc a {name} { exists $name }
	a ::a
} 1

test exists-1.1 "Exists in proc" {
	a ::b
} 0

test exists-1.1 "Exists in proc" {
	a name
} 1

test exists-1.1 "Exists in proc" {
	a none
} 0

test exists-1.1 "Exists -proc" {
	exists -proc a
} 1

test exists-1.1 "Exists -proc" {
	exists -proc bogus
} 0

test exists-1.1 "Exists -proc" {
	exists -proc info
} 0

test exists-1.1 "Exists -command" {
	exists -command a
} 1

test exists-1.1 "Exists -command" {
	exists -command info
} 1

test exists-1.1 "Exists -command" {
	exists -command bogus
} 0

test exists-1.1 "Exists local lambda after exit" lambda {
	proc a {} {
		local lambda {} {dummy}
	}
	exists -proc [a]
} 0

test exists-1.1 "Exists local lambda" lambda {
	proc a {} {
		exists -proc [local lambda {} {dummy}]
	}
	a
} 1

testreport