diff options
author | sebres <sebres@users.sourceforge.net> | 2020-03-11 15:33:28 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2020-03-11 15:33:28 (GMT) |
commit | 14fd6b059e2e8ea5c2d5758b8a2800f3413e02f3 (patch) | |
tree | 266287d877ffdb24aa9c016c41c514600d970d44 | |
parent | f13b7726c4db8ae40da10effbd492cefd7aca015 (diff) | |
download | tcl-14fd6b059e2e8ea5c2d5758b8a2800f3413e02f3.zip tcl-14fd6b059e2e8ea5c2d5758b8a2800f3413e02f3.tar.gz tcl-14fd6b059e2e8ea5c2d5758b8a2800f3413e02f3.tar.bz2 |
lpop.test: added test illustrating segfault in [234d6c811d] (and small review - stability of tests depending on outside circumstances, e. g. in case of -singleproc)
-rw-r--r-- | tests/lpop.test | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/lpop.test b/tests/lpop.test index 89b651c..3e28978 100644 --- a/tests/lpop.test +++ b/tests/lpop.test @@ -16,6 +16,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { namespace import -force ::tcltest::* } +unset -nocomplain no; # following tests expecting var "no" does not exists test lpop-1.1 {error conditions} -returnCodes error -body { lpop no } -result {can't read "no": no such variable} @@ -23,32 +24,36 @@ test lpop-1.2 {error conditions} -returnCodes error -body { lpop no 0 } -result {can't read "no": no such variable} test lpop-1.3 {error conditions} -returnCodes error -body { - set no "x {}x" - lpop no + set l "x {}x" + lpop l } -result {list element in braces followed by "x" instead of space} test lpop-1.4 {error conditions} -returnCodes error -body { - set no "x y" - lpop no -1 + set l "x y" + lpop l -1 } -result {index "-1" out of range} +test lpop-1.4b {error conditions (also check SF on empty list variable, bug [234d6c811d])} -body { + set l "x y" + list [lpop l] [lpop l] [catch {lpop l} v] $v [catch {lpop l 0} v] $v $l +} -result {y x 1 {index "end" out of range} 1 {index "0" out of range} {}} test lpop-1.5 {error conditions} -returnCodes error -body { - set no "x y z" - lpop no 3 + set l "x y z" + lpop l 3 } -result {index "3" out of range} ;#-errorCode {TCL OPERATION LPOP BADINDEX} test lpop-1.6 {error conditions} -returnCodes error -body { - set no "x y" - lpop no end+1 + set l "x y" + lpop l end+1 } -result {index "end+1" out of range} test lpop-1.7 {error conditions} -returnCodes error -body { - set no "x y" - lpop no {} + set l "x y" + lpop l {} } -match glob -result {bad index *} test lpop-1.8 {error conditions} -returnCodes error -body { - set no "x y" - lpop no 0 0 0 0 1 + set l "x y" + lpop l 0 0 0 0 1 } -result {index "1" out of range} test lpop-1.9 {error conditions} -returnCodes error -body { - set no "x y" - lpop no {1 0} + set l "x y" + lpop l {1 0} } -match glob -result {bad index *} test lpop-2.1 {basic functionality} -body { |