summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-07-14 08:31:00 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-07-14 08:31:00 (GMT)
commitc65f04435b80a065f992d534fcd8bfc9a5a0e8ef (patch)
tree634fb50b290fe6487db35c2bbab743301a410ec4 /tests
parent09c67efdce34a8588ab4cb53e007e8ec603dc081 (diff)
downloadtcl-c65f04435b80a065f992d534fcd8bfc9a5a0e8ef.zip
tcl-c65f04435b80a065f992d534fcd8bfc9a5a0e8ef.tar.gz
tcl-c65f04435b80a065f992d534fcd8bfc9a5a0e8ef.tar.bz2
[77d58e3a7a] Test case independence: chanio, cmdah, env, history.
Diffstat (limited to 'tests')
-rw-r--r--tests/chanio.test23
-rw-r--r--tests/cmdAH.test8
-rw-r--r--tests/env.test12
-rw-r--r--tests/history.test5
4 files changed, 40 insertions, 8 deletions
diff --git a/tests/chanio.test b/tests/chanio.test
index 2738fc6..29f42c3 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -4160,12 +4160,20 @@ test chan-io-33.4 {Tcl_Gets with long line} -setup {
} -cleanup {
chan close $f
} -result {abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
-test chan-io-33.5 {Tcl_Gets with long line} {
+test chan-io-33.5 {Tcl_Gets with long line} -setup {
+ set f [open $path(test3) w]
+ puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ puts $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ close $f
+} -body {
set f [open $path(test3)]
set x [chan gets $f y]
chan close $f
list $x $y
-} {260 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
+} -result {260 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
test chan-io-33.6 {Tcl_Gets and end of file} -setup {
file delete $path(test3)
set x {}
@@ -6765,7 +6773,12 @@ test chan-io-52.10 {TclCopyChannel & encodings} {fcopy} {
chan close $out
file size $path(utf8-fcopy.txt)
} 5
-test chan-io-52.11 {TclCopyChannel & encodings} {fcopy} {
+test chan-io-52.11 {TclCopyChannel & encodings} -setup {
+ set f [open $path(utf8-fcopy.txt) w]
+ fconfigure $f -encoding utf-8
+ puts $f "\u0410\u0410"
+ close $f
+} -constraints {fcopy} -body {
# binary to encoding => the input has to be in utf-8 to make sense to the
# encoder
set in [open $path(utf8-fcopy.txt) r]
@@ -6777,7 +6790,9 @@ test chan-io-52.11 {TclCopyChannel & encodings} {fcopy} {
chan close $in
chan close $out
file size $path(kyrillic.txt)
-} 3
+} -cleanup {
+ file delete $path(utf8-fcopy.txt)
+} -result 3
test chan-io-53.1 {CopyData} -setup {
file delete $path(test1)
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index ef933cb..6418aae 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -141,9 +141,13 @@ test cmdAH-2.6.2 {cd} -constraints {unix nonPortable} -setup {
} -cleanup {
cd $dir
} -result {/}
-test cmdAH-2.6.3 {Tcl_CdObjCmd, bug #3118489} -returnCodes error -body {
+test cmdAH-2.6.3 {Tcl_CdObjCmd, bug #3118489} -setup {
+ set dir [pwd]
+} -returnCodes error -body {
cd .\0
-} -result "couldn't change working directory to \".\0\": no such file or directory"
+} -cleanup {
+ cd $dir
+} -match glob -result "couldn't change working directory to \".\0\": *"
test cmdAH-2.7 {Tcl_ConcatObjCmd} {
concat
} {}
diff --git a/tests/env.test b/tests/env.test
index 9f59fbc..0dd4f98 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -19,7 +19,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
# Some tests require the "exec" command.
# Skip them if exec is not defined.
testConstraint exec [llength [info commands exec]]
-
+
#
# These tests will run on any platform (and indeed crashed on the Mac). So put
# them before you test for the existance of exec.
@@ -147,6 +147,7 @@ test env-2.2 {adding environment variables} -setup {
} -result {NAME1=test string}
test env-2.3 {adding environment variables} -setup {
encoding system iso8859-1
+ set env(NAME1) "test string"
} -constraints {exec} -body {
set env(NAME2) "more"
getenv
@@ -156,6 +157,8 @@ test env-2.3 {adding environment variables} -setup {
NAME2=more}
test env-2.4 {adding environment variables} -setup {
encoding system iso8859-1
+ set env(NAME1) "test string"
+ set env(NAME2) "more"
} -constraints {exec} -body {
set env(XYZZY) "garbage"
getenv
@@ -165,7 +168,9 @@ test env-2.4 {adding environment variables} -setup {
NAME2=more
XYZZY=garbage}
+set env(NAME1) "test string"
set env(NAME2) "new value"
+set env(XYZZY) "garbage"
test env-3.1 {changing environment variables} -setup {
encoding system iso8859-1
} -constraints {exec} -body {
@@ -177,6 +182,7 @@ test env-3.1 {changing environment variables} -setup {
} -result {NAME1=test string
NAME2=new value
XYZZY=garbage}
+unset -nocomplain env(NAME2)
test env-4.1 {unsetting environment variables: default} -setup {
encoding system iso8859-1
@@ -195,6 +201,7 @@ test env-4.2 {unsetting environment variables} -setup {
unset env(XYZZY)
encoding system $sysenc
} -result {XYZZY=garbage}
+unset -nocomplain env(NAME1) env(XYZZY)
test env-4.3 {setting international environment variables} -setup {
encoding system iso8859-1
} -constraints {exec} -body {
@@ -213,6 +220,7 @@ test env-4.4 {changing international environment variables} -setup {
} -result {\u00a7=\u00a7}
test env-4.5 {unsetting international environment variables} -setup {
encoding system iso8859-1
+ set env(\ua7) \ua7
} -body {
set env(\ub6) \ua7
unset env(\ua7)
@@ -323,7 +331,7 @@ test env-7.3 {[9b4702]: testing existence of env(some_thing) should not destroy
return [info exists ::env(test7_3)]
}}
} -result 1
-
+
# Restore the environment variables at the end of the test.
foreach name [array names env] {
diff --git a/tests/history.test b/tests/history.test
index c562796..7549beb 100644
--- a/tests/history.test
+++ b/tests/history.test
@@ -233,6 +233,7 @@ if {[testConstraint history]} {
test history-8.1 {clear option} history {catch {history clear junk}} 1
test history-8.2 {clear option} history {history clear} {}
if {[testConstraint history]} {
+ history clear
history add "Testing"
}
test history-8.3 {clear option} history {history} { 1 Testing}
@@ -248,3 +249,7 @@ test history-9.2 {miscellaneous} history {
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: