From 4cf6a38e55fbdf502fcbb4d15c8ad94e4f891e6d Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 24 Nov 2000 15:14:01 +0000 Subject: Added test to detect bug #119153; the string forms of boolean values should not be second-class citizens in the Tcl world... --- ChangeLog | 3 +++ tests/expr.test | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cf5d077..69595c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-11-24 Donal K. Fellows + * tests/expr.test (expr-13.17): Check that [expr {!$var}] can + negate the string-versions of booleans "yes", "false", etc. + * library/tcltest/tcltest.tcl (getMatchingFiles, getMatchingDirectories): * tools/man2html.tcl (doDir): diff --git a/tests/expr.test b/tests/expr.test index 9ea5026..05b8f9d 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.10 2000/05/09 00:00:37 hobbs Exp $ +# RCS: @(#) $Id: expr.test,v 1.11 2000/11/24 15:14:01 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -466,6 +466,11 @@ test expr-13.16 {CompileUnaryExpr: error in primary expr} { catch {expr [set]} msg set msg } {wrong # args: should be "set varName ?newValue?"} +test expr-13.17 {CompileUnaryExpr: negating non-numeric boolean literals} { + set a1 yes; set a0 no; set b1 true; set b0 false + list [expr {!$a1}] [expr {!$a0}] [expr {!$b1}] [expr {!$b0}] +} {0 1 0 1} + test expr-14.1 {CompilePrimaryExpr: literal primary} {expr 1} 1 test expr-14.2 {CompilePrimaryExpr: literal primary} {expr 123} 123 test expr-14.3 {CompilePrimaryExpr: literal primary} {expr 0xff} 255 -- cgit v0.12