Files
fail/debuggers/openocd/jimtcl/tests/exists.test
Lars Rademacher 83d72a091e debuggers: import openocd-0.7.0
Initial check-in of openocd-0.7.0 as it can be downloaded from
http://sourceforge.net/projects/openocd/files/openocd/0.7.0/

Any modifications will follow.

Change-Id: I6949beaefd589e046395ea0cb80f4e1ab1654d55
2013-12-02 14:53:22 +01:00

80 lines
1.1 KiB
Plaintext

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