File:  [Research Unix] / researchv10dc / cmd / worm / scsi / tcl / tests / exec.test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:33 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

# This file contains contains a collection of tests for the "exec"
# command in Tcl.  If everything is OK then it finishes silently.
# If a problem is detected then it generates a Tcl error with a
# cryptic message.  To trace the error you'll have to read through
# the commands in this file.
#
# $Header: /var/lib/cvsd/repos/research/researchv10dc/cmd/worm/scsi/tcl/tests/exec.test,v 1.1.1.1 2018/04/24 17:21:33 root Exp $ (Berkeley)

proc check {a b num} {
    if {[string compare $a $b] != 0} {
	error [format {Exec error %s: wanted "%s", got "%s"} $num $b $a]}
}

# Basic operations.

set a [exec echo a b c]
check $a "a b c\n" 1.1
set a [exec wc < "a b c d" -w]
scan $a %d b
check $b 4 1.2
set a [exec cat < foo]
check $a foo 1.3

# Long input to test using file instead of pipe.  This also tests
# the ability to collect output in several steps.

set a "0123456789 xxxxxxxxx abcdefghi ABCDEFGHIJK\n"
set a [concat $a $a $a $a]
set a [concat $a $a $a $a]
set a [concat $a $a $a $a]
set a [concat $a $a $a $a]
set b [exec cat < $a]
check $a $b 1.4

# Error conditions.

check [catch {exec cat <} b] 1 2.1
check $b {specified "<" but no input in "exec" command} 2.2
check [catch {exec false} b] 1 2.3
check $b {} 2.4

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.