summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-11-20 10:15:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-11-20 10:15:59 (GMT)
commitfe95dc974b3f250804b78d76f7b633742981c6a9 (patch)
tree2d9bf6a998ebe64c6b23ed7a7ac327bb9946764e
parent0b9b9c72ad5f37774ca120083d29d439ae125187 (diff)
downloadtcl-fe95dc974b3f250804b78d76f7b633742981c6a9.zip
tcl-fe95dc974b3f250804b78d76f7b633742981c6a9.tar.gz
tcl-fe95dc974b3f250804b78d76f7b633742981c6a9.tar.bz2
Fix error-message for min/math functions: "to" -> "for", for consistancy with the error-messages for other math functions.
-rw-r--r--library/init.tcl4
-rw-r--r--tests/expr-old.test20
2 files changed, 18 insertions, 6 deletions
diff --git a/library/init.tcl b/library/init.tcl
index 87d9f14..13a4300 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -79,7 +79,7 @@ namespace eval tcl {
proc min {args} {
if {![llength $args]} {
return -code error \
- "too few arguments to math function \"min\""
+ "too few arguments for math function \"min\""
}
set val Inf
foreach arg $args {
@@ -95,7 +95,7 @@ namespace eval tcl {
proc max {args} {
if {![llength $args]} {
return -code error \
- "too few arguments to math function \"max\""
+ "too few arguments for math function \"max\""
}
set val -Inf
foreach arg $args {
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 3adfb63..8c159b2 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -1159,8 +1159,8 @@ test expr-old-40.2 {min math function} -body {
expr {min(0.0)}
} -result 0.0
test expr-old-40.3 {min math function} -body {
- list [catch {expr {min()}} msg] $msg
-} -result {1 {too few arguments to math function "min"}}
+ expr {min()}
+} -returnCodes error -result {too few arguments for math function "min"}
test expr-old-40.4 {min math function} -body {
expr {min(wide(-1) << 30, 4.5, -10)}
} -result [expr {wide(-1) << 30}]
@@ -1170,6 +1170,12 @@ test expr-old-40.5 {min math function} -body {
test expr-old-40.6 {min math function} -body {
expr {min(300, "0xFF")}
} -result 255
+test expr-old-40.7 {min math function} -body {
+ expr min(1[string repeat 0 10000], 1e300)
+} -result 1e+300
+test expr-old-40.8 {min math function} -body {
+ expr {min(0, "a")}
+} -returnCodes error -match glob -result *
test expr-old-41.1 {max math function} -body {
expr {max(0)}
@@ -1178,8 +1184,8 @@ test expr-old-41.2 {max math function} -body {
expr {max(0.0)}
} -result 0.0
test expr-old-41.3 {max math function} -body {
- list [catch {expr {max()}} msg] $msg
-} -result {1 {too few arguments to math function "max"}}
+ expr {max()}
+} -returnCodes error -result {too few arguments for math function "max"}
test expr-old-41.4 {max math function} -body {
expr {max(wide(1) << 30, 4.5, -10)}
} -result [expr {wide(1) << 30}]
@@ -1189,6 +1195,12 @@ test expr-old-41.5 {max math function} -body {
test expr-old-41.6 {max math function} -body {
expr {max(200, "0xFF")}
} -result 255
+test expr-old-41.7 {max math function} -body {
+ expr max(1[string repeat 0 10000], 1e300)
+} -result 1[string repeat 0 10000]
+test expr-old-41.8 {max math function} -body {
+ expr {max(0, "a")}
+} -returnCodes error -match glob -result *
# Special test for Pentium arithmetic bug of 1994: