|
|
1.1 ! root 1: # This file contains contains a collection of tests for the "exec" ! 2: # command in Tcl. If everything is OK then it finishes silently. ! 3: # If a problem is detected then it generates a Tcl error with a ! 4: # cryptic message. To trace the error you'll have to read through ! 5: # the commands in this file. ! 6: # ! 7: # $Header: /sprite/src/lib/tcl/tests/RCS/exec.test,v 1.1 90/04/16 17:28:54 ouster Exp $ (Berkeley) ! 8: ! 9: proc check {a b num} { ! 10: if {[string compare $a $b] != 0} { ! 11: error [format {Exec error %s: wanted "%s", got "%s"} $num $b $a]} ! 12: } ! 13: ! 14: # Basic operations. ! 15: ! 16: set a [exec echo a b c] ! 17: check $a "a b c\n" 1.1 ! 18: set a [exec wc < "a b c d" -w] ! 19: scan $a %d b ! 20: check $b 4 1.2 ! 21: set a [exec cat < foo] ! 22: check $a foo 1.3 ! 23: ! 24: # Long input to test using file instead of pipe. This also tests ! 25: # the ability to collect output in several steps. ! 26: ! 27: set a "0123456789 xxxxxxxxx abcdefghi ABCDEFGHIJK\n" ! 28: set a [concat $a $a $a $a] ! 29: set a [concat $a $a $a $a] ! 30: set a [concat $a $a $a $a] ! 31: set a [concat $a $a $a $a] ! 32: set b [exec cat < $a] ! 33: check $a $b 1.4 ! 34: ! 35: # Error conditions. ! 36: ! 37: check [catch {exec cat <} b] 1 2.1 ! 38: check $b {specified "<" but no input in "exec" command} 2.2 ! 39: check [catch {exec false} b] 1 2.3 ! 40: check $b {} 2.4
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.