From 5d20272000e4f0b9ad2d2e16c4835debcac832dd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 May 2017 14:31:17 +0000 Subject: Don't test Tcl_GetDefaultEncodingDir() any more (which is obsolete), test Tcl_GetEncodingSearchPath() in stead. --- tests/encoding.test | 14 +++++++------- tests/unixInit.test | 17 +++++++++++------ unix/tclUnixTest.c | 45 ++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index 4dddbb5..d9ba072 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -35,7 +35,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint exec [llength [info commands exec]] -testConstraint testgetdefenc [llength [info commands testgetdefenc]] +testConstraint testgetencpath [llength [info commands testgetencpath]] # TclInitEncodingSubsystem is tested by the rest of this file # TclFinalizeEncodingSubsystem is not currently tested @@ -570,15 +570,15 @@ foreach from {cp932 shiftjis euc-jp iso2022-jp} { } } -test encoding-26.0 {Tcl_GetDefaultEncodingDir} -constraints { - testgetdefenc +test encoding-26.0 {Tcl_GetEncodingSearchPath} -constraints { + testgetencpath } -setup { - set origDir [testgetdefenc] - testsetdefenc slappy + set origPath [testgetencpath] + testsetencpath slappy } -body { - testgetdefenc + testgetencpath } -cleanup { - testsetdefenc $origDir + testsetencpath $origPath } -result slappy file delete {*}[glob -directory [temporaryDirectory] *.chars *.tcltestout] diff --git a/tests/unixInit.test b/tests/unixInit.test index 05338ed..0469ee8 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -15,6 +15,9 @@ namespace import ::tcltest::* unset -nocomplain path catch {set oldlang $env(LANG)} set env(LANG) C + +# Some tests require the testgetencpath command +testConstraint testgetencpath [llength [info commands testgetencpath]] test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unix stdio} { set x {} @@ -87,13 +90,15 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unix stdio} skip [concat [skip] unixInit-2.*] -test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} { - set origDir [testgetdefenc] - testsetdefenc slappy - set path [testgetdefenc] - testsetdefenc $origDir +test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} -constraints { + testgetencpath +} -body { + set origPath [testgetencpath] + testsetencpath slappy + set path [testgetencpath] + testsetencpath $origPath set path -} {slappy} +} -result {slappy} test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup { unset -nocomplain oldlibrary if {[info exists env(TCL_LIBRARY)]} { diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 86e0925..ceb64d9 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -68,10 +68,10 @@ static Tcl_CmdProc TestfilehandlerCmd; static Tcl_CmdProc TestfilewaitCmd; static Tcl_CmdProc TestfindexecutableCmd; static Tcl_ObjCmdProc TestforkObjCmd; -static Tcl_CmdProc TestgetdefencdirCmd; +static Tcl_ObjCmdProc TestgetencpathObjCmd; static Tcl_CmdProc TestgetopenfileCmd; static Tcl_CmdProc TestgotsigCmd; -static Tcl_CmdProc TestsetdefencdirCmd; +static Tcl_ObjCmdProc TestsetencpathObjCmd; static Tcl_FileProc TestFileHandlerProc; static void AlarmHandler(int signum); @@ -108,9 +108,9 @@ TclplatformtestInit( NULL, NULL); Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testgetencpath", TestgetencpathObjCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testsetencpath", TestsetencpathObjCmd, NULL, NULL); Tcl_CreateCommand(interp, "testalarm", TestalarmCmd, NULL, NULL); @@ -499,9 +499,9 @@ TestgetopenfileCmd( /* *---------------------------------------------------------------------- * - * TestsetdefencdirCmd -- + * TestsetencpathCmd -- * - * This function implements the "testsetdefenc" command. It is used to + * This function implements the "testsetencpath" command. It is used to * test Tcl_SetDefaultEncodingDir(). * * Results: @@ -514,19 +514,18 @@ TestgetopenfileCmd( */ static int -TestsetdefencdirCmd( +TestsetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " defaultDir\"", NULL); + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; } - Tcl_SetDefaultEncodingDir(argv[1]); + Tcl_SetEncodingSearchPath(objv[1]); return TCL_OK; } @@ -552,7 +551,7 @@ TestforkObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *const *objv) /* Argument strings. */ + Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; @@ -578,10 +577,10 @@ TestforkObjCmd( /* *---------------------------------------------------------------------- * - * TestgetdefencdirCmd -- + * TestgetencpathObjCmd -- * - * This function implements the "testgetdefenc" command. It is used to - * test Tcl_GetDefaultEncodingDir(). + * This function implements the "testgetencpath" command. It is used to + * test Tcl_GetEncodingSearchPath(). * * Results: * A standard Tcl result. @@ -593,18 +592,18 @@ TestforkObjCmd( */ static int -TestgetdefencdirCmd( +TestgetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 1) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], NULL); + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } - Tcl_AppendResult(interp, Tcl_GetDefaultEncodingDir(), NULL); + Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath()); return TCL_OK; } -- cgit v0.12