summaryrefslogtreecommitdiffstats
path: root/tests/for.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-30 13:56:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-30 13:56:15 (GMT)
commitf163c24b4c9dd8b0e7c72274f1c008384ea8f514 (patch)
tree07e16057cf7afb1744e971639e8bd8359c9a3e9f /tests/for.test
parent076a7e2839881c03d0a98a8fc50823aef42ad79a (diff)
downloadtcl-f163c24b4c9dd8b0e7c72274f1c008384ea8f514.zip
tcl-f163c24b4c9dd8b0e7c72274f1c008384ea8f514.tar.gz
tcl-f163c24b4c9dd8b0e7c72274f1c008384ea8f514.tar.bz2
Simplify testcases using "incr"
Diffstat (limited to 'tests/for.test')
-rw-r--r--tests/for.test102
1 files changed, 51 insertions, 51 deletions
diff --git a/tests/for.test b/tests/for.test
index 64ec22c..a13ee54 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -62,7 +62,7 @@ test for-1.8 {TclCompileForCmd: error compiling command body} -body {
catch {unset a}
test for-1.9 {TclCompileForCmd: simple command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ for {set i 1} {$i<6} {incr i} {
if {$i==4} break
set a [concat $a $i]
}
@@ -70,7 +70,7 @@ test for-1.9 {TclCompileForCmd: simple command body} {
} {1 2 3}
test for-1.10 {TclCompileForCmd: command body in quotes} {
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} "append a x"
+ for {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-1.11 {TclCompileForCmd: computed command body} {
@@ -81,7 +81,7 @@ test for-1.11 {TclCompileForCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} $x1$bb$x2
+ for {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-1.12 {TclCompileForCmd: error in "next" command} -body {
@@ -92,7 +92,7 @@ test for-1.12 {TclCompileForCmd: error in "next" command} -body {
"set"*}
test for-1.13 {TclCompileForCmd: long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ for {set i 1} {$i<6} {incr i} {
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {
@@ -144,7 +144,7 @@ test for-2.2 {TclCompileContinueCmd: continue result} {
} 4
test for-2.3 {continue tests} {
set a {}
- for {set i 1} {$i <= 4} {set i [expr {$i+1}]} {
+ for {set i 1} {$i <= 4} {incr i} {
if {$i == 2} continue
set a [concat $a $i]
}
@@ -152,7 +152,7 @@ test for-2.3 {continue tests} {
} {1 3 4}
test for-2.4 {continue tests} {
set a {}
- for {set i 1} {$i <= 4} {set i [expr {$i+1}]} {
+ for {set i 1} {$i <= 4} {incr i} {
if {$i != 2} continue
set a [concat $a $i]
}
@@ -170,7 +170,7 @@ test for-2.5 {continue tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-2.6 {continue tests, long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ for {set i 1} {$i<6} {incr i} {
if {$i==2} continue
if {$i==4} break
if {$i>5} continue
@@ -246,7 +246,7 @@ test for-3.4 {break tests, nested loops} {
} {1.1 1.2 2.1 3.1 4.1}
test for-3.5 {break tests, long command body} {
set a {}
- for {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ for {set i 1} {$i<6} {incr i} {
if {$i==2} continue
if {$i==5} break
if {$i>5} continue
@@ -303,35 +303,35 @@ proc formatMail {} {
16 {This page contains information about Tcl 7.6 and Tk4.2, which are the most recent} \
17 {releases of the Tcl scripting language and the Tk toolkit. The first beta versions of these} \
18 {releases were released on August 30, 1996. These releases contain only minor changes,} \
- 19 {so we hope to have only a single beta release and to go final in early October, 1996. } \
+ 19 {so we hope to have only a single beta release and to go final in early October, 1996.} \
20 {} \
21 {} \
- 22 {What's new } \
+ 22 {What's new} \
23 {} \
24 {The most important changes in the releases are summarized below. See the README} \
25 {and changes files in the distributions for more complete information on what has} \
- 26 {changed, including both feature changes and bug fixes. } \
+ 26 {changed, including both feature changes and bug fixes.} \
27 {} \
28 { There are new options to the file command for copying files (file copy),} \
29 { deleting files and directories (file delete), creating directories (file} \
- 30 { mkdir), and renaming files (file rename). } \
+ 30 { mkdir), and renaming files (file rename).} \
31 { The implementation of exec has been improved greatly for Windows 95 and} \
- 32 { Windows NT. } \
+ 32 { Windows NT.} \
33 { There is a new memory allocator for the Macintosh version, which should be} \
- 34 { more efficient than the old one. } \
+ 34 { more efficient than the old one.} \
35 { Tk's grid geometry manager has been completely rewritten. The layout} \
36 { algorithm produces much better layouts than before, especially where rows or} \
- 37 { columns were stretchable. } \
+ 37 { columns were stretchable.} \
38 { There are new commands for creating common dialog boxes:} \
39 { tk_chooseColor, tk_getOpenFile, tk_getSaveFile and} \
- 40 { tk_messageBox. These use native dialog boxes if they are available. } \
+ 40 { tk_messageBox. These use native dialog boxes if they are available.} \
41 { There is a new virtual event mechanism for handling events in a more portable} \
42 { way. See the new command event. It also allows events (both physical and} \
- 43 { virtual) to be generated dynamically. } \
+ 43 { virtual) to be generated dynamically.} \
44 {} \
45 {Tcl 7.6 and Tk 4.2 are backwards-compatible with Tcl 7.5 and Tk 4.1 except for} \
46 {changes in the C APIs for custom channel drivers. Scripts written for earlier releases} \
- 47 {should work on these new releases as well. } \
+ 47 {should work on these new releases as well.} \
48 {} \
49 {Obtaining The Releases} \
50 {} \
@@ -342,7 +342,7 @@ proc formatMail {} {
55 { Windows 3.1, Windows 95, and Windows NT: Fetch} \
56 { ftp://ftp.sunlabs.com/pub/tcl/win42b1.exe, then execute it. The file is a} \
57 { self-extracting executable. It will install the Tcl and Tk libraries, the wish and} \
- 58 { tclsh programs, and documentation. } \
+ 58 { tclsh programs, and documentation.} \
59 { Macintosh (both 68K and PowerPC): Fetch} \
60 { ftp://ftp.sunlabs.com/pub/tcl/mactk4.2b1.sea.hqx. The file is in binhex format,} \
61 { which is understood by Fetch, StuffIt, and many other Mac utilities. The} \
@@ -451,7 +451,7 @@ proc formatMail {} {
set c [string length $line]
}
}
- set newline [string range $line 0 $c]
+ set newline [string trimright [string range $line 0 $c]]
if {! $continuation} {
append result $newline $NL
} else {
@@ -507,76 +507,76 @@ releases of the Tcl scripting language and the Tk toolk
it. The first beta versions of these
releases were released on August 30, 1996. These releas
es contain only minor changes,
-so we hope to have only a single beta release and to
+so we hope to have only a single beta release and to
go final in early October, 1996.
-What's new
+What's new
The most important changes in the releases are summariz
ed below. See the README
and changes files in the distributions for more complet
e information on what has
-changed, including both feature changes and bug fixes.
+changed, including both feature changes and bug fixes.
- There are new options to the file command for
+ There are new options to the file command for
copying files (file copy),
- deleting files and directories (file delete),
+ deleting files and directories (file delete),
creating directories (file
- mkdir), and renaming files (file rename).
+ mkdir), and renaming files (file rename).
The implementation of exec has been improved great
ly for Windows 95 and
- Windows NT.
- There is a new memory allocator for the Macintosh
+ Windows NT.
+ There is a new memory allocator for the Macintosh
version, which should be
- more efficient than the old one.
- Tk's grid geometry manager has been completely
+ more efficient than the old one.
+ Tk's grid geometry manager has been completely
rewritten. The layout
algorithm produces much better layouts than before
, especially where rows or
- columns were stretchable.
- There are new commands for creating common dialog
+ columns were stretchable.
+ There are new commands for creating common dialog
boxes:
tk_chooseColor, tk_getOpenFile, tk_getSaveFile and
- tk_messageBox. These use native dialog boxes if
+ tk_messageBox. These use native dialog boxes if
they are available.
There is a new virtual event mechanism for handlin
g events in a more portable
- way. See the new command event. It also allows
+ way. See the new command event. It also allows
events (both physical and
- virtual) to be generated dynamically.
+ virtual) to be generated dynamically.
-Tcl 7.6 and Tk 4.2 are backwards-compatible with Tcl
+Tcl 7.6 and Tk 4.2 are backwards-compatible with Tcl
7.5 and Tk 4.1 except for
changes in the C APIs for custom channel drivers. Scrip
ts written for earlier releases
-should work on these new releases as well.
+should work on these new releases as well.
Obtaining The Releases
Binary Releases
-Pre-compiled releases are available for the following
+Pre-compiled releases are available for the following
platforms:
Windows 3.1, Windows 95, and Windows NT: Fetch
- ftp://ftp.sunlabs.com/pub/tcl/win42b1.exe, then
+ ftp://ftp.sunlabs.com/pub/tcl/win42b1.exe, then
execute it. The file is a
- self-extracting executable. It will install the
+ self-extracting executable. It will install the
Tcl and Tk libraries, the wish and
- tclsh programs, and documentation.
+ tclsh programs, and documentation.
Macintosh (both 68K and PowerPC): Fetch
- ftp://ftp.sunlabs.com/pub/tcl/mactk4.2b1.sea.hqx.
+ ftp://ftp.sunlabs.com/pub/tcl/mactk4.2b1.sea.hqx.
The file is in binhex format,
- which is understood by Fetch, StuffIt, and many
+ which is understood by Fetch, StuffIt, and many
other Mac utilities. The
- unpacked file is a self-installing executable:
+ unpacked file is a self-installing executable:
double-click on it and it will create a
- folder containing all that you need to run Tcl
+ folder containing all that you need to run Tcl
and Tk.
- UNIX (Solaris 2.* and SunOS, other systems
+ UNIX (Solaris 2.* and SunOS, other systems
soon to follow). Easy to install
- binary packages are now for sale at the Sun Labs
+ binary packages are now for sale at the Sun Labs
Tcl/Tk Shop. Check it out!
}
@@ -696,7 +696,7 @@ test for-6.9 {Tcl_ForObjCmd: error executing command body} -body {
test for-6.10 {Tcl_ForObjCmd: simple command body} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ $z {set i 1} {$i<6} {incr i} {
if {$i==4} break
set a [concat $a $i]
}
@@ -705,7 +705,7 @@ test for-6.10 {Tcl_ForObjCmd: simple command body} {
test for-6.11 {Tcl_ForObjCmd: command body in quotes} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr {$i+1}]} "append a x"
+ $z {set i 1} {$i<6} {incr i} "append a x"
set a
} {xxxxx}
test for-6.12 {Tcl_ForObjCmd: computed command body} {
@@ -717,7 +717,7 @@ test for-6.12 {Tcl_ForObjCmd: computed command body} {
set bb {break}
set x2 {; append a x2}
set a {}
- $z {set i 1} {$i<6} {set i [expr {$i+1}]} $x1$bb$x2
+ $z {set i 1} {$i<6} {incr i} $x1$bb$x2
set a
} {x1}
test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
@@ -733,7 +733,7 @@ test for-6.13 {Tcl_ForObjCmd: error in "next" command} -body {
test for-6.14 {Tcl_ForObjCmd: long command body} {
set z for
set a {}
- $z {set i 1} {$i<6} {set i [expr {$i+1}]} {
+ $z {set i 1} {$i<6} {incr i} {
if {$i==4} break
if {$i>5} continue
if {$i>6 && $tcl_platform(machine)=="xxx"} {