⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 for.test

📁 tcl是工具命令语言
💻 TEST
📖 第 1 页 / 共 2 页
字号:
		    append result $line $NL		    if {$quote && !$inheaders} {			# Fix from <sarr@umich.edu> to handle text/enriched			if {$L > $L1 && $L < $L2 && $line != {}} {			    # enriched requires two newlines for each one.			    append result $NL			} elseif {$L > $L2} {			    set L1 [lindex $ranges 0]			    set L2 [lindex $ranges 1]			    set ranges [lrange $ranges 2 end]			    set quote [llength $L1]			}		    }		    continue		}	    }	    if {$F1 < 0} {		# Nothing left to format		append result $line $NL		continue	    } elseif {$L < $F1} {		# Not yet to formatted block		append result $line $NL		continue	    } elseif {$L > $F2} {		# Past formatted block		set F1 [lindex $breakrange 0]		set F2 [lindex $breakrange 1]		set breakrange [lrange $breakrange 2 end]		append result $line $NL		if {[string length $F1] == 0} {		    set F1 -1		}		continue	    }	}	set climit [expr $limit-1]	set cutoff 50	set continuation 0		while {[string length $line] > $limit} {	    for {set c [expr $limit-1]} {$c >= $cutoff} {incr c -1} {		set char [string index $line $c]		if {$char == " " || $char == "\t"} {		    break		}		if {$char == ">"} {	;# Hack for enriched formatting		    break		}	    }	    if {$c < $cutoff} {		if {! $inheaders} {		    set c [expr $limit-1]		} else {		    set c [string length $line]		}	    }	    set newline [string range $line 0 $c]	    if {! $continuation} {		append result $newline $NL	    } else {		append result \ $newline $NL	    }	    incr c	    set line [string trimright [string range $line $c end]]	    if {$inheaders} {		set continuation 1		set limit $climit	    }	}	if {$continuation} {	    if {[string length $line] != 0} {		append result \ $line $NL	    }	} else {	    append result $line $NL	    if {$quote && !$inheaders} {		if {$L > $L1 && $L < $L2 && $line != {}} {		    # enriched requires two newlines for each one.		    append result "" $NL		} elseif {$L > $L2} {		    set L1 [lindex $ranges 0]		    set L2 [lindex $ranges 1]		    set ranges [lrange $ranges 2 end]		    set quote [llength $L1]		}	    }	}    }    return $result}test for-3.6 {break tests} {    formatMail} {Return-path: <george@tcl>Received: from tcl by tcl.Somewhere.COM (SMI-8.6/SMI-SVR4)	id LAA10027; Wed, 11 Sep 1996 11:14:53 -0700Message-id: <199609111814.LAA10027@tcl.Somewhere.COM>Mime-version: 1.0Content-type: text/plain; charset=iso-8859-1Content-transfer-encoding: quoted-printableContent-length: 2162To: fredSubject: tcl7.6Date: Wed, 11 Sep 1996 11:14:53 -0700From: George <george@tcl>The Tcl 7.6 and Tk 4.2 releasesThis page contains information about Tcl 7.6 and Tk4.2, which are the most recentreleases of the Tcl scripting language and the Tk toolkit. The first beta versions of thesereleases were released on August 30, 1996. These releases contain only minor changes,so we hope to have only a single beta release and to go final in early October, 1996.What's new The most important changes in the releases are summarized below. See the READMEand changes files in the distributions for more complete information on what haschanged, including both feature changes and bug fixes.      There are new options to the file command for copying files (file copy),     deleting files and directories (file delete), creating directories (file     mkdir), and renaming files (file rename).      The implementation of exec has been improved greatly for Windows 95 and     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 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 boxes:     tk_chooseColor, tk_getOpenFile, tk_getSaveFile and     tk_messageBox. These use native dialog boxes if they are available.     There is a new virtual event mechanism for handling events in a more portable     way. See the new command event. It also allows events (both physical and     virtual) to be generated dynamically. Tcl 7.6 and Tk 4.2 are backwards-compatible with Tcl 7.5 and Tk 4.1 except forchanges in the C APIs for custom channel drivers. Scripts written for earlier releasesshould work on these new releases as well. Obtaining The ReleasesBinary ReleasesPre-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 execute it. The file is a     self-extracting executable. It will install the Tcl and Tk libraries, the wish and     tclsh programs, and documentation.      Macintosh (both 68K and PowerPC): Fetch     ftp://ftp.sunlabs.com/pub/tcl/mactk4.2b1.sea.hqx. The file is in binhex format,     which is understood by Fetch, StuffIt, and many other Mac utilities. The     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 and Tk.        UNIX (Solaris 2.* and SunOS, other systems soon to follow). Easy to install     binary packages are now for sale at the Sun Labs Tcl/Tk Shop. Check it out!}# Check that "break" resets the interpreter's resulttest for-4.1 {break must reset the interp result} {    catch {        set z GLOBTESTDIR/dir2/file2.c        if [string match GLOBTESTDIR/dir2/* $z] {            break        }    } j    set j} {}# Test for incorrect "double evaluation" semanticstest for-5.1 {possible delayed substitution of increment command} {    # Increment should be 5, and lappend should always append $a    catch {unset a}    catch {unset i}    set a 5    set i {}    for {set a 1} {$a < 12} "incr a $a" {lappend i $a}    set i} {1 6 11}test for-5.2 {possible delayed substitution of increment command} {    # Increment should be 5, and lappend should always append $a    catch {rename p ""}    proc p {} {	set a 5	set i {}	for {set a 1} {$a < 12} "incr a $a" {lappend i $a}	set i    }    p} {1 6 11}test for-5.3 {possible delayed substitution of body command} {    # Increment should be $a, and lappend should always append 5    set a 5    set i {}    for {set a 1} {$a < 12} {incr a $a} "lappend i $a"    set i} {5 5 5 5}test for-5.4 {possible delayed substitution of body command} {    # Increment should be $a, and lappend should always append 5    catch {rename p ""}    proc p {} {	set a 5	set i {}	for {set a 1} {$a < 12} {incr a $a} "lappend i $a"	set i    }    p} {5 5 5 5}# In the following tests we need to bypass the bytecode compiler by# substituting the command from a variable.  This ensures that command# procedure is invoked directly.test for-6.1 {Tcl_ForObjCmd: number of args} {    set z for    catch {$z} msg    set msg} {wrong # args: should be "for start test next command"}test for-6.2 {Tcl_ForObjCmd: number of args} {    set z for    catch {$z {set i 0}} msg    set msg} {wrong # args: should be "for start test next command"}test for-6.3 {Tcl_ForObjCmd: number of args} {    set z for    catch {$z {set i 0} {$i < 5}} msg    set msg} {wrong # args: should be "for start test next command"}test for-6.4 {Tcl_ForObjCmd: number of args} {    set z for    catch {$z {set i 0} {$i < 5} {incr i}} msg    set msg} {wrong # args: should be "for start test next command"}test for-6.5 {Tcl_ForObjCmd: number of args} {    set z for    catch {$z {set i 0} {$i < 5} {incr i} {body} extra} msg    set msg} {wrong # args: should be "for start test next command"}test for-6.6 {Tcl_ForObjCmd: error in initial command} {    set z for    list [catch {$z {set} {$i < 5} {incr i} {body}} msg] $msg $errorInfo} {1 {wrong # args: should be "set varName ?newValue?"} {wrong # args: should be "set varName ?newValue?"    while compiling"set"    ("for" initial command)    invoked from within"$z {set} {$i < 5} {incr i} {body}"}}test for-6.7 {Tcl_ForObjCmd: error in test expression} {    set z for    list [catch {$z {set i 0} {i < 5} {incr i} {body}} msg] $msg $errorInfo} {1 {syntax error in expression "i < 5": variable references require preceding $} {syntax error in expression "i < 5": variable references require preceding $    while executing"$z {set i 0} {i < 5} {incr i} {body}"}}test for-6.8 {Tcl_ForObjCmd: test expression is enclosed in quotes} {    set z for    set i 0    $z {set i 6} "$i > 5" {incr i} {set y $i}    set i} 6test for-6.9 {Tcl_ForObjCmd: error executing command body} {    set z for    catch {$z {set i 0} {$i < 5} {incr i} {set}} msg    set errorInfo} {wrong # args: should be "set varName ?newValue?"    while compiling"set"    ("for" body line 1)    invoked from within"$z {set i 0} {$i < 5} {incr i} {set}"}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]} {	if $i==4 break	set a [concat $a $i]    }    set a} {1 2 3}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"    set a} {xxxxx}test for-6.12 {Tcl_ForObjCmd: computed command body} {    set z for    catch {unset x1}    catch {unset bb}    catch {unset x2}    set x1 {append a x1; }    set bb {break}    set x2 {; append a x2}    set a {}    $z {set i 1} {$i<6} {set i [expr $i+1]} $x1$bb$x2    set a} {x1}test for-6.13 {Tcl_ForObjCmd: error in "next" command} {    set z for    catch {$z {set i 0} {$i < 5} {set} {set j 4}} msg    set errorInfo} {wrong # args: should be "set varName ?newValue?"    while compiling"set"    ("for" loop-end command)    invoked from within"$z {set i 0} {$i < 5} {set} {set j 4}"}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]} {	if $i==4 break	if $i>5 continue	if {$i>6 && $tcl_platform(machine)=="xxx"} {	    catch {set a $a} msg	    catch {incr i 5} msg	    catch {incr i -5} msg	}	if {$i>6 && $tcl_platform(machine)=="xxx"} {	    catch {set a $a} msg	    catch {incr i 5} msg	    catch {incr i -5} msg	}	if {$i>6 && $tcl_platform(machine)=="xxx"} {	    catch {set a $a} msg	    catch {incr i 5} msg	    catch {incr i -5} msg	}	if {$i>6 && $tcl_platform(machine)=="xxx"} {	    catch {set a $a} msg	    catch {incr i 5} msg	    catch {incr i -5} msg	}	if {$i>6 && $tcl_platform(machine)=="xxx"} {	    catch {set a $a} msg	    catch {incr i 5} msg	    catch {incr i -5} msg	}	set a [concat $a $i]    }    set a} {1 2 3}test for-6.15 {Tcl_ForObjCmd: for command result} {    set z for    set a [$z {set i 0} {$i < 5} {incr i} {}]    set a} {}test for-6.16 {Tcl_ForObjCmd: for command result} {    set z for    set a [$z {set i 0} {$i < 5} {incr i} {if $i==3 break}]    set a} {}# cleanup::tcltest::cleanupTestsreturn

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -