89 lines
3.1 KiB
Diff
89 lines
3.1 KiB
Diff
From a965b9b2624fefd1087fca8505ba3b486772ee70 Mon Sep 17 00:00:00 2001
|
|
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
|
|
Date: Mon, 20 Nov 2017 10:15:59 +0000
|
|
Subject: [PATCH 0718/1800] Fix error-message for min/math functions: "to" ->
|
|
"for", for consistancy with the error-messages for other math functions.
|
|
|
|
---
|
|
library/init.tcl | 4 ++--
|
|
tests/expr-old.test | 20 ++++++++++++++++----
|
|
2 files changed, 18 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/library/init.tcl b/library/init.tcl
|
|
index 87d9f14da..13a4300c3 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 3adfb635f..8c159b2bb 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:
|
|
|
|
--
|
|
2.19.1
|
|
|