summaryrefslogtreecommitdiffstats
path: root/tests/exec.test
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-02-04 18:23:30 (GMT)
committervincentdarley <vincentdarley>2003-02-04 18:23:30 (GMT)
commit3dac6b45f9d6639c9bece03e3ada8d6b196fab12 (patch)
treef0bd175516c222fd043fcbd2d4ce1c55121f1442 /tests/exec.test
parent7d7c7570591f8383688fe05c69fdea70106a937e (diff)
downloadtcl-3dac6b45f9d6639c9bece03e3ada8d6b196fab12.zip
tcl-3dac6b45f9d6639c9bece03e3ada8d6b196fab12.tar.gz
tcl-3dac6b45f9d6639c9bece03e3ada8d6b196fab12.tar.bz2
test suite fixes for spaces in paths
Diffstat (limited to 'tests/exec.test')
-rw-r--r--tests/exec.test96
1 files changed, 48 insertions, 48 deletions
diff --git a/tests/exec.test b/tests/exec.test
index 38c6f41..fd80dcf 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: exec.test,v 1.15 2002/11/27 02:51:00 hobbs Exp $
+# RCS: @(#) $Id: exec.test,v 1.16 2003/02/04 18:23:35 vincentdarley Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -182,37 +182,37 @@ test exec-3.7 {redirecting output to file} {exec} {
removeFile gorp.file
test exec-4.1 {redirecting output and stderr to file} {exec} {
- exec [interpreter] $path(echo) "test output" >& $path(gorp.file)
- exec [interpreter] $path(cat) $path(gorp.file)
+ exec [interpreter] "$path(echo)" "test output" >& $path(gorp.file)
+ exec [interpreter] "$path(cat)" "$path(gorp.file)"
} "test output"
test exec-4.2 {redirecting output and stderr to file} {exec} {
- list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" >&$path(gorp.file)] \
- [exec [interpreter] $path(cat) $path(gorp.file)]
+ list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" >&$path(gorp.file)] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
} {{} {foo bar}}
test exec-4.3 {redirecting output and stderr to file} {exec} {
exec [interpreter] $path(echo) "first line" > $path(gorp.file)
- list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" >>&$path(gorp.file)] \
- [exec [interpreter] $path(cat) $path(gorp.file)]
+ list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" >>&$path(gorp.file)] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
} "{} {first line\nfoo bar}"
test exec-4.4 {redirecting output and stderr to file} {exec} {
- set f [open $path(gorp.file) w]
+ set f [open "$path(gorp.file)" w]
puts $f "Line 1"
flush $f
- exec [interpreter] $path(echo) "More text" >&@ $f
- exec [interpreter] $path(echo) >&@$f "Even more"
+ exec [interpreter] "$path(echo)" "More text" >&@ $f
+ exec [interpreter] "$path(echo)" >&@$f "Even more"
puts $f "Line 3"
close $f
- exec [interpreter] $path(cat) $path(gorp.file)
+ exec [interpreter] "$path(cat)" "$path(gorp.file)"
} "Line 1\nMore text\nEven more\nLine 3"
test exec-4.5 {redirecting output and stderr to file} {exec} {
- set f [open $path(gorp.file) w]
+ set f [open "$path(gorp.file)" w]
puts $f "Line 1"
flush $f
- exec >&@ $f [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2"
- exec >&@$f [interpreter] $path(sh) -c "$path(echo) xyzzy 1>&2"
+ exec >&@ $f [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2"
+ exec >&@$f [interpreter] "$path(sh)" -c "\"$path(echo)\" xyzzy 1>&2"
puts $f "Line 3"
close $f
- exec [interpreter] $path(cat) $path(gorp.file)
+ exec [interpreter] "$path(cat)" "$path(gorp.file)"
} "Line 1\nfoo bar\nxyzzy\nLine 3"
# I/O redirection: input from file.
@@ -251,14 +251,14 @@ test exec-5.7 {redirecting input from file} {exec} {
# I/O redirection: standard error through a pipeline.
test exec-6.1 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] $path(sh) -c "$path(echo) foo bar" |& [interpreter] $path(cat)
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar" |& [interpreter] "$path(cat)"
} "foo bar"
test exec-6.2 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" |& [interpreter] $path(cat)
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" |& [interpreter] "$path(cat)"
} "foo bar"
test exec-6.3 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \
- |& [interpreter] $path(sh) -c "$path(echo) second msg 1>&2 ; $path(cat)" |& [interpreter] $path(cat)
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
+ |& [interpreter] "$path(sh)" -c "\"$path(echo)\" second msg 1>&2 ; \"$path(cat)\"" |& [interpreter] "$path(cat)"
} "second msg\nfoo bar"
# I/O redirection: combinations.
@@ -311,11 +311,11 @@ test exec-9.5 {commands returning errors} {exec stdio} {
list [catch {exec gorp456 | [interpreter] echo a b c} msg] [string tolower $msg]
} {1 {couldn't execute "gorp456": no such file or directory}}
test exec-9.6 {commands returning errors} {exec} {
- list [catch {exec [interpreter] $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg
+ list [catch {exec [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2"} msg] $msg
} {1 {error msg}}
test exec-9.7 {commands returning errors} {exec stdio} {
- list [catch {exec [interpreter] $path(sh) -c "$path(echo) error msg 1>&2" \
- | [interpreter] $path(sh) -c "$path(echo) error msg 1>&2"} msg] $msg
+ list [catch {exec [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2" \
+ | [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2"} msg] $msg
} {1 {error msg
error msg}}
@@ -420,7 +420,7 @@ test exec-11.4 {commands in background} {exec stdio} {
} 3
test exec-11.5 {commands in background} {exec} {
set f [open $path(gorp.file) w]
- puts $f [format { catch { exec [info nameofexecutable] %s foo & } } $path(echo)]
+ puts $f [format { catch { exec [info nameofexecutable] {%s} foo & } } $path(echo)]
close $f
string compare "foo" [exec [interpreter] $path(gorp.file)]
} 0
@@ -503,43 +503,43 @@ test exec-14.4 {-- switch} {exec} {
# Redirecting standard error separately from standard output
test exec-15.1 {standard error redirection} {exec} {
- exec [interpreter] $path(echo) "First line" > $path(gorp.file)
- list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2> $path(gorp.file)] \
- [exec [interpreter] $path(cat) $path(gorp.file)]
+ exec [interpreter] "$path(echo)" "First line" > "$path(gorp.file)"
+ list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2> "$path(gorp.file)"] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
} {{} {foo bar}}
test exec-15.2 {standard error redirection} {exec stdio} {
- list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \
- | [interpreter] $path(echo) biz baz >$path(gorp.file) 2> $path(gorp.file2)] \
- [exec [interpreter] $path(cat) $path(gorp.file)] \
- [exec [interpreter] $path(cat) $path(gorp.file2)]
+ list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
+ | [interpreter] "$path(echo)" biz baz >$path(gorp.file) 2> "$path(gorp.file2)"] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file)"] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file2)"]
} {{} {biz baz} {foo bar}}
test exec-15.3 {standard error redirection} {exec stdio} {
- list [exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" \
- | [interpreter] $path(echo) biz baz 2>$path(gorp.file) > $path(gorp.file2)] \
- [exec [interpreter] $path(cat) $path(gorp.file)] \
- [exec [interpreter] $path(cat) $path(gorp.file2)]
+ list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
+ | [interpreter] "$path(echo)" biz baz 2>$path(gorp.file) > "$path(gorp.file2)"] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file)"] \
+ [exec [interpreter] "$path(cat)" "$path(gorp.file2)"]
} {{} {foo bar} {biz baz}}
test exec-15.4 {standard error redirection} {exec} {
- set f [open $path(gorp.file) w]
+ set f [open "$path(gorp.file)" w]
puts $f "Line 1"
flush $f
- exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2>@ $f
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2>@ $f
puts $f "Line 3"
close $f
- exec [interpreter] $path(cat) $path(gorp.file)
+ exec [interpreter] "$path(cat)" "$path(gorp.file)"
} {Line 1
foo bar
Line 3}
test exec-15.5 {standard error redirection} {exec} {
- exec [interpreter] $path(echo) "First line" > $path(gorp.file)
- exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" 2>> $path(gorp.file)
- exec [interpreter] $path(cat) $path(gorp.file)
+ exec [interpreter] "$path(echo)" "First line" > "$path(gorp.file)"
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2>> "$path(gorp.file)"
+ exec [interpreter] "$path(cat)" "$path(gorp.file)"
} {First line
foo bar}
test exec-15.6 {standard error redirection} {exec stdio} {
- exec [interpreter] $path(sh) -c "$path(echo) foo bar 1>&2" > $path(gorp.file2) 2> $path(gorp.file) \
- >& $path(gorp.file) 2> $path(gorp.file2) | [interpreter] $path(echo) biz baz
- list [exec [interpreter] $path(cat) $path(gorp.file)] [exec [interpreter] $path(cat) $path(gorp.file2)]
+ exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" > "$path(gorp.file2)" 2> "$path(gorp.file)" \
+ >& "$path(gorp.file)" 2> "$path(gorp.file2)" | [interpreter] "$path(echo)" biz baz
+ list [exec [interpreter] "$path(cat)" "$path(gorp.file)"] [exec [interpreter] "$path(cat)" "$path(gorp.file2)"]
} {{biz baz} {foo bar}}
test exec-16.1 {flush output before exec} {exec} {
@@ -568,9 +568,9 @@ set path(script) [makeFile {} script]
test exec-17.1 { inheriting standard I/O } {exec} {
set f [open $path(script) w]
puts $f [format {close stdout
- set f [open %s w]
- catch {exec [info nameofexecutable] %s foobar &}
- exec [info nameofexecutable] %s 2
+ set f [open {%s} w]
+ catch {exec [info nameofexecutable] {%s} foobar &}
+ exec [info nameofexecutable] {%s} 2
close $f
} $path(gorp.file) $path(echo) $path(sleep)]
close $f
@@ -582,7 +582,7 @@ test exec-17.1 { inheriting standard I/O } {exec} {
} {{foobar
}}
-test exec-18.1 { exec cat deals with weird file names} {exec unixOnly} {
+test exec-18.1 { exec cat deals with weird file names} {exec tempNotWin} {
# This is cross-platform, but the cat isn't predictably correct on
# Windows.
set f "foo\[\{blah"
@@ -598,7 +598,7 @@ test exec-18.1 { exec cat deals with weird file names} {exec unixOnly} {
# cleanup
foreach file {script gorp.file gorp.file2 echo cat wc sh sleep exit err} {
- removeFile $file
+ removeFile $file
}
::tcltest::cleanupTests