summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2009-01-03 04:36:53 (GMT)
committerKevin B Kenny <kennykb@acm.org>2009-01-03 04:36:53 (GMT)
commitb49de0b49faa2b9f256293a43ce833376f29ab43 (patch)
tree60ce30ae5abebbdb46ad8dd9194023ac5ad5c6e0
parente6cf33a18dc5565003147b37744ef972ca11d902 (diff)
downloadtcl-b49de0b49faa2b9f256293a43ce833376f29ab43.zip
tcl-b49de0b49faa2b9f256293a43ce833376f29ab43.tar.gz
tcl-b49de0b49faa2b9f256293a43ce833376f29ab43.tar.bz2
* library/clock.tcl (tcl::clock::add): Fixed error message formatting
in the case where [clock add] is presented with a bad switch. * tests/clock.test (clock-65.1) Added a test case for the above problem [Bug 2481670].
-rw-r--r--ChangeLog8
-rw-r--r--library/clock.tcl6
-rw-r--r--tests/clock.test11
3 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ffff1a..3b8570c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-01-03 Kevin B. Kenny <kennykb@acm.org>:
+
+ * library/clock.tcl (tcl::clock::add): Fixed error message formatting
+ in the case where [clock add] is presented with a bad switch.
+ * tests/clock.test (clock-65.1) Added a test case for the above
+ problem [Bug 2481670].
+
+
2008-12-21 Don Porter <dgp@users.sourceforge.net>
*** 8.5.6 TAGGED FOR RELEASE ***
diff --git a/library/clock.tcl b/library/clock.tcl
index 4a34b82..8a78c39 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.tcl,v 1.47.2.4 2008/12/12 17:46:13 nijtmans Exp $
+# RCS: @(#) $Id: clock.tcl,v 1.47.2.5 2009/01/03 04:36:53 kennykb Exp $
#
#----------------------------------------------------------------------
@@ -4378,8 +4378,8 @@ proc ::tcl::clock::add { clockval args } {
}
default {
return -code error \
- -errorcode [list CLOCK badSwitch $flag] \
- "bad switch \"$flag\",\
+ -errorcode [list CLOCK badSwitch $a] \
+ "bad switch \"$a\",\
must be -gmt, -locale or -timezone"
}
}
diff --git a/tests/clock.test b/tests/clock.test
index 8cc5bdb..c58ac0e 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: clock.test,v 1.83.2.4 2008/12/11 14:05:28 nijtmans Exp $
+# RCS: @(#) $Id: clock.test,v 1.83.2.5 2009/01/03 04:36:53 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -36679,6 +36679,15 @@ test clock-64.2 {:: in format string [Bug 2362156]} {*}{
-result 2001-02-03::04:05:06
}
+test clock-65.1 {clock add, bad option [Bug 2481670]} {*}{
+ -body {
+ clock add 0 1 year -foo bar
+ }
+ -returnCodes error
+ -match glob
+ -result {bad switch "-foo"*}
+}
+
# cleanup
namespace delete ::testClock