diff options
-rw-r--r-- | generic/tclTest.c | 20 | ||||
-rw-r--r-- | generic/tclTestProcBodyObj.c | 4 | ||||
-rw-r--r-- | tests/pkgMkIndex.test | 16 | ||||
-rw-r--r-- | tests/resource.test | 25 |
4 files changed, 41 insertions, 24 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index d989fa5..7454771 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.5 1998/09/14 18:40:02 stanton Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.6 1998/11/10 06:54:33 jingham Exp $ */ #define TCL_TEST @@ -2824,14 +2824,18 @@ TeststatprocCmd (dummy, interp, argc, argv) return retVal; } - +/* Be careful in the compares in these tests, since the Macintosh puts a + * leading : in the beginning of non-absolute paths before passing them + * into the file command procedures. + */ + static int TestStatProc1(path, buf) CONST char *path; TclStat_ *buf; { buf->st_size = 1234; - return (strcmp("testStat1%.fil", path) ? -1 : 0); + return ((strstr(path, "testStat1%.fil") == NULL) ? -1 : 0); } @@ -2841,7 +2845,7 @@ TestStatProc2(path, buf) TclStat_ *buf; { buf->st_size = 2345; - return (strcmp("testStat2%.fil", path) ? -1 : 0); + return ((strstr(path, "testStat2%.fil") == NULL) ? -1 : 0); } @@ -2851,7 +2855,7 @@ TestStatProc3(path, buf) TclStat_ *buf; { buf->st_size = 3456; - return (strcmp("testStat3%.fil", path) ? -1 : 0); + return ((strstr(path, "testStat3%.fil") == NULL) ? -1 : 0); } /* @@ -2934,7 +2938,7 @@ TestAccessProc1(path, mode) CONST char *path; int mode; { - return (strcmp("testAccess1%.fil", path) ? -1 : 0); + return ((strstr(path, "testAccess1%.fil") == NULL) ? -1 : 0); } @@ -2943,7 +2947,7 @@ TestAccessProc2(path, mode) CONST char *path; int mode; { - return (strcmp("testAccess2%.fil", path) ? -1 : 0); + return ((strstr(path, "testAccess2%.fil") == NULL) ? -1 : 0); } @@ -2952,7 +2956,7 @@ TestAccessProc3(path, mode) CONST char *path; int mode; { - return (strcmp("testAccess3%.fil", path) ? -1 : 0); + return ((strstr(path, "testAccess3%.fil") == NULL) ? -1 : 0); } /* diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index b4e15c2..7d66e75 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTestProcBodyObj.c,v 1.1 1998/10/05 22:32:10 escoffon Exp $ + * RCS: @(#) $Id: tclTestProcBodyObj.c,v 1.2 1998/11/10 06:54:44 jingham Exp $ */ #include "tclInt.h" @@ -50,6 +50,8 @@ static int ProcBodyTestInitInternal _ANSI_ARGS_((Tcl_Interp *interp, int isSafe)); static int RegisterCommand _ANSI_ARGS_((Tcl_Interp* interp, char *namespace, CONST CmdTable *cmdTablePtr)); +int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp * interp)); +int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp * interp)); /* * List of commands to create when the package is loaded; must go after the diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test index a91b158..abec11c 100644 --- a/tests/pkgMkIndex.test +++ b/tests/pkgMkIndex.test @@ -8,7 +8,7 @@ # Copyright (c) 1998 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: pkgMkIndex.test,v 1.2 1998/10/30 23:02:03 welch Exp $ +# RCS: @(#) $Id: pkgMkIndex.test,v 1.3 1998/11/10 06:54:11 jingham Exp $ if {[string compare test [info procs test]] == 1} then {source defs} @@ -279,7 +279,7 @@ test pkgMkIndex-2.1 {simple package} { test pkgMkIndex-2.2 {simple package - use -direct} { runIndex -direct pkg simple.tcl -} {0 {{simple:1.0 {source pkg/simple.tcl}}}} +} "0 {{simple:1.0 {source [file join pkg simple.tcl]}}}" test pkgMkIndex-3.1 {simple package with global symbols} { runIndex pkg global.tcl @@ -291,8 +291,8 @@ test pkgMkIndex-4.1 {split package} { test pkgMkIndex-4.2 {split package - direct loading} { runIndex -direct pkg pkg2_a.tcl pkg2_b.tcl -} {0 {{pkg2:1.0 {source pkg/pkg2_a.tcl -source pkg/pkg2_b.tcl}}}} +} "0 {{pkg2:1.0 {source [file join pkg pkg2_a.tcl] +source [file join pkg pkg2_b.tcl]}}}" # This will fail, with "direct1" procedures in the list of procedures # provided by std. @@ -310,7 +310,7 @@ test pkgMkIndex-6.1 {pkg1 requires pkg3} { test pkgMkIndex-6.2 {pkg1 requires pkg3 - use -direct} { runIndex -direct pkg pkg1.tcl pkg3.tcl -} {0 {{pkg1:1.0 {source pkg/pkg1.tcl}} {pkg3:1.0 {source pkg/pkg3.tcl}}}} +} "0 {{pkg1:1.0 {source [file join pkg pkg1.tcl]}} {pkg3:1.0 {source [file join pkg pkg3.tcl]}}}" test pkgMkIndex-7.1 {pkg4 uses pkg3} { runIndex pkg pkg4.tcl pkg3.tcl @@ -318,7 +318,7 @@ test pkgMkIndex-7.1 {pkg4 uses pkg3} { test pkgMkIndex-7.2 {pkg4 uses pkg3 - use -direct} { runIndex -direct pkg pkg4.tcl pkg3.tcl -} {0 {{pkg3:1.0 {source pkg/pkg3.tcl}} {pkg4:1.0 {source pkg/pkg4.tcl}}}} +} "0 {{pkg3:1.0 {source [file join pkg pkg3.tcl]}} {pkg4:1.0 {source [file join pkg pkg4.tcl]}}}" test pkgMkIndex-8.1 {pkg5 uses pkg2} { runIndex pkg pkg5.tcl pkg2_a.tcl pkg2_b.tcl @@ -326,8 +326,8 @@ test pkgMkIndex-8.1 {pkg5 uses pkg2} { test pkgMkIndex-8.2 {pkg5 uses pkg2 - use -direct} { runIndex -direct pkg pkg5.tcl pkg2_a.tcl pkg2_b.tcl -} {0 {{pkg2:1.0 {source pkg/pkg2_a.tcl -source pkg/pkg2_b.tcl}} {pkg5:1.0 {source pkg/pkg5.tcl}}}} +} "0 {{pkg2:1.0 {source [file join pkg pkg2_a.tcl] +source [file join pkg pkg2_b.tcl]}} {pkg5:1.0 {source [file join pkg pkg5.tcl]}}}" test pkgMkIndex-9.1 {circular packages} { runIndex pkg circ1.tcl circ2.tcl circ3.tcl diff --git a/tests/resource.test b/tests/resource.test index c1d9a9e..91e93a4 100644 --- a/tests/resource.test +++ b/tests/resource.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: resource.test,v 1.2 1998/09/14 18:40:13 stanton Exp $ +# RCS: @(#) $Id: resource.test,v 1.3 1998/11/10 06:54:20 jingham Exp $ # Only run this test on Macintosh systems if {$tcl_platform(platform) != "macintosh"} { @@ -45,27 +45,38 @@ test resource-2.5 {resource open & close tests} { } {} test resource-2.6 {resource open & close tests} { catch {file delete rsrc.file} - testWriteTextResource -rsrc fileRsrcName -file rsrc.file {error "don't source me"} + testWriteTextResource -rsrc fileRsrcName -file rsrc.file {A test string} set id [resource open rsrc.file] set result [string compare [resource open rsrc.file] $id] + lappend result [resource read TEXT fileRsrcName $id] resource close $id file delete rsrc.file set result -} {0} +} {0 {A test string}} test resource-2.7 {resource open & close tests} { + catch {file delete rsrc.file} + testWriteTextResource -rsrc fileRsrcName -file rsrc.file {error "don't source me"} + set id [resource open rsrc.file r] + set result [catch {resource open rsrc.file w} mssg] + resource close $id + file delete rsrc.file + lappend result $mssg + set result +} {1 {Resource already open with different permissions.}} +test resource-2.8 {resource open & close tests} { list [catch {resource close} msg] $msg } {1 {wrong # args: should be "resource close resourceRef"}} -test resource-2.8 {resource open & close tests} { +test resource-2.9 {resource open & close tests} { list [catch {resource close foo bar} msg] $msg } {1 {wrong # args: should be "resource close resourceRef"}} -test resource-2.9 {resource open & close tests} { +test resource-2.10 {resource open & close tests} { list [catch {resource close _bad_resource_} msg] $msg } {1 {invalid resource file reference "_bad_resource_"}} -test resource-2.10 {resource open & close tests} { +test resource-2.11 {resource open & close tests} { set result [catch {resource close System} mssg] lappend result $mssg } {1 {can't close "System" resource file}} -test resource-2.11 {resource open & close tests} { +test resource-2.12 {resource open & close tests} { set result [catch {resource close application} mssg] lappend result $mssg } {1 {can't close "application" resource file}} |