diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2024-09-11 03:04:10 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2024-09-11 03:04:10 (GMT) |
| commit | bb8c0eb0333ac22c7bd5f1936a355c1bb232b345 (patch) | |
| tree | 6abba21bd1bc092a3c99c4a57faa5b469c27cb6e /generic/tclTest.c | |
| parent | 8c9951c670f22b297b3a10c0bc2ab7cb31442bbd (diff) | |
| download | tcl-bb8c0eb0333ac22c7bd5f1936a355c1bb232b345.zip tcl-bb8c0eb0333ac22c7bd5f1936a355c1bb232b345.tar.gz tcl-bb8c0eb0333ac22c7bd5f1936a355c1bb232b345.tar.bz2 | |
Add Tcl_FSTildeExpand and tests
Diffstat (limited to 'generic/tclTest.c')
| -rw-r--r-- | generic/tclTest.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index d995046..79f7952 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -308,6 +308,7 @@ static Tcl_CmdProc TestsetplatformCmd; static Tcl_ObjCmdProc TestSizeCmd; static Tcl_CmdProc TeststaticlibraryCmd; static Tcl_CmdProc TesttranslatefilenameCmd; +static Tcl_ObjCmdProc TestfstildeexpandCmd; static Tcl_CmdProc TestupvarCmd; static Tcl_ObjCmdProc2 TestWrongNumArgsObjCmd; static Tcl_ObjCmdProc TestGetIndexFromObjStructObjCmd; @@ -726,6 +727,8 @@ Tcltest_Init( NULL, NULL); Tcl_CreateCommand(interp, "testtranslatefilename", TesttranslatefilenameCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testfstildeexpand", + TestfstildeexpandCmd, NULL, NULL); Tcl_CreateCommand(interp, "testupvar", TestupvarCmd, NULL, NULL); Tcl_CreateCommand(interp, "testmainthread", TestmainthreadCmd, NULL, NULL); @@ -4943,6 +4946,45 @@ TesttranslatefilenameCmd( /* *---------------------------------------------------------------------- * + * TestfstildeexpandCmd -- + * + * This procedure implements the "testfstildeexpand" command. + * It is used to test the Tcl_FSTildeExpand command. It differs + * from the script level "file tildeexpand" tests because of a + * slightly different code path. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestfstildeexpandCmd( + TCL_UNUSED(void *), + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* The argument objects. */ +{ + Tcl_DString buffer; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "PATH"); + return TCL_ERROR; + } + if (Tcl_FSTildeExpand(interp, Tcl_GetString(objv[1]), &buffer) != TCL_OK) { + return TCL_ERROR; + } + Tcl_SetObjResult(interp, Tcl_DStringToObj(&buffer)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestupvarCmd -- * * This procedure implements the "testupvar" command. It is used |
