aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2020-06-05tests: allow more time for some testsSteve Bennett3-18/+18
If running in a VM with very variable time Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05tests: Fix some tests when certain features are disabledSteve Bennett3-7/+13
namespace, ssl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05core: command (proc) names may now contained embedded nullsSteve Bennett2-0/+6
The hash table used to store commands now uses Jim_Obj keys rather than allocated char *, so embedded nulls are supported. This means that some API function such as Jim_RenameCommand() now take Jim_Obj * rather than const char *, however Jim_CreateCommand() is retained with const char * for convenience and the new Jim_CreateCommandObj() is added. This is generally a performance win as the existing Jim_Obj can be used as the key. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05core: string match and other glob matching support embedded nullsSteve Bennett2-2/+21
string match, switch -glob, info commands, etc. all now support patterns and strings with embedded nulls. Fixes #143 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-06-05core: variable names may now contain embedded nullsSteve Bennett5-17/+17
Hash tables used to store variables are now use Jim_Obj keys rather than allocated char *, so embedded nulls are supported. This is generally a performance win as the existing Jim_Obj can be used as the key. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-28test(aio,socket,tty): match musl error messagesD. Bohdan3-5/+5
2020-05-07tests: interactive.tests requires socket pty supportSteve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-07tests: Add interactive mode testsSteve Bennett2-0/+368
Using a custom "expect-like" module to allow testing Jim in interactive mode. This also exercises the 'socket pty' support. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-07lsearch, switch: fix -regexp case with option-like patternSteve Bennett2-0/+17
If the pattern begins with -, the internal invocation of regexp will treat the pattern as an option. Fix this by adding -- to the internal invocation of regexp. Fixes #154 Reported-by: Barry Arthur <barry.arthur@gmail.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: socket.test check for ipv6 supportSteve Bennett1-4/+18
Skip ipv6 tests if not supported Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: jimsh.tests additional testsSteve Bennett1-0/+16
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: ssl.test: Enable SNI and test verifySteve Bennett1-4/+8
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06aio: Fix eventloop and eof for ssl connectionsSteve Bennett2-9/+9
We can't use feof() and 'buffering none' on ssl connections. Instead we have to get eof from the ssl layer, and provide special handling for buffering in the eventloop. For eof, add ssl_eof() and detect SSL_read() results that indicate eof to set AIO_EOF in flags. For buffering, add 'read -pending' that will read, and then immediately read any buffered data so that the 'readable' event will trigger next time. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: add ssl.testSteve Bennett3-0/+168
Note that there is currently a problem with ssl and readable events Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests: add socket.testsSteve Bennett1-0/+367
Basic testing of each of the socket types Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06tests/runall.tcl: support tests that forkSteve Bennett1-0/+7
Because we use catch -exit { ... }, if a test uses os.fork we will return in both the parent in the child. To fix this, require the child to use exit 99, and detect this case and exit from the child in this case. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-06exit: Set the exit code as the interp resultSteve Bennett2-3/+3
If exit is caught with catch -exit, it is currently not possible to retrieve the exit value. If an exit code is provided, set it as the interp result. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04tests: Fixes to recent tests for windowsSteve Bennett5-18/+27
Mostly just avoiding running certain tests, but also: - rename() won't overwrite an existing file on Windows - ensure that eof returns 0 or 1 - in aio.test, create and read the file in binary mode Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04jim.c: Fix UpdateStringOfIndex()Steve Bennett1-0/+8
In case the index is invalid, the string should contain -MAX_INT Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04scan: Fix a utf-8 bug for string lengthSteve Bennett1-0/+7
The string length was being checked in chars instead of bytes Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04regsub: Fix regsub -all with \ASteve Bennett1-5/+5
regsub -all matches \A against the start of each match, but correctly handle a pattern like ^ which does not advance the match Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04regexp: Improved error messageSteve Bennett1-5/+4
Detect and produce an error for missing closing bracket ] Consider a trailing backslash as an invalid escape Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04signal check: fix error returnSteve Bennett1-4/+2
If the signal is invalid, indicate that Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04unpack: consistent error messagesSteve Bennett1-7/+5
between pack and unpack Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file readlink: change error message to match TclSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file: rootname, dirname fixes to match TclSteve Bennett1-2/+9
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04tests: Add many new additional tests for code coverageSteve Bennett24-52/+1589
readdir, tty, utf8, signal, alarm, kill, file, jimsh, posix, aio, history, interp, pack, unpack, eventloop, exec, load, package, regexp, regsub Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-28tests: namespace.testSteve Bennett1-0/+25
More namespace tests from Evan Hunter Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-28tests: debug.testEvan Hunter1-0/+109
Also requires fixing 'debug' command so that the interpreter & tcltest.tcl can tell it is not supported. And the result of 'debug show' is now returned as the interpreter result rather than being printed.
2020-04-17tests: file tempfile: don't do path/template tests on windowsSteve Bennett1-3/+8
As Windows doesn't respect the path/template Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17tests: improve code coverageSteve Bennett6-0/+175
- clock - array - file tempfile - lreverse - string byterange - aio tty Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17local, rename: don't allow renaming a local proc with upcallSteve Bennett1-1/+20
If an existing command was replaced when using local proc ..., then renaming the command will break upcall from within the proc because the command no longer exists in the namespace. To prevent this case, disallow rename of such a command. It is still OK to delete with rename <cmd> "" Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17parsing: Fix error with missing quoteSteve Bennett1-0/+21
If a quote is missing inside a command, e.g.["command here] the error should indicate that a quote is missing, not a bracket. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17env: Fix error in case of too many argumentsSteve Bennett1-0/+15
Should produce an error, but did not previously Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17apply: ignore the current namespaceSteve Bennett1-0/+16
If a namespace is given, it is relative to the global namespace not the current namespace. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-17expr: avoid memory leak due to shimmeringSteve Bennett1-0/+13
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-04-02tailcall: Fix to avoid tailcalls consuming C stack framesSteve Bennett2-1/+19
The purpose of a tailcall is to avoid using additional stack frames, however although were were not creating an extra Tcl callframe we were using C stack frames through the call sequence: JimCallProcedure -> Jim_EvalObjList -> JimInvokeCommand -> JimCallProcedure This meant that a large number of tailcalls would overflow the stack. Instead we need to have JimCallProcedure return to JimInvokeCommand where the tailcall can be handled by a subsequent call to JimCallProcedure. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-03-05build: Check for 32-bit time_t at configure timeSteve Bennett1-5/+0
To warn of Y2038 problems, and suggest use of -D__MINGW_USE_VC2005_COMPAT on mingw32. Do this instead of the previous runtime test. Add -D__MINGW_USE_VC2005_COMPAT to the appveyor build. Fixes msteveb/jimtcl#145 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-03-04clock: test and doc non-Y2038 complianceSteve Bennett1-0/+5
Add a note in the documentation for clock that some systems use 32-bit time_t and are thus not year 2038 compliant. Also add a test to catch this in clock.test Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-12-30regexp: Reset scanner position on failed optional groupSteve Bennett1-0/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-12-13tests: Fix misc.test for new return -level 0 behaviourSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-12-13return: fix -level 0 -code xxxSteve Bennett1-2/+9
Should return the given return code, not JIM_RETURN (2) Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-11-30string map and string compare now support embedded nullsSteve Bennett1-0/+21
Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-11-11json: implement -index decode optiondbohdan1-0/+24
2019-11-09json: Fix decode schema for list objSteve Bennett1-0/+3
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-11-09json: Add json encoder/decoderSteve Bennett1-0/+146
Using the jsmn library for decoding. Based on the original implementation by Svyatoslav Mishyn <juef@openmailbox.org> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-11-06expr-sugar: $() should return non-error codesSteve Bennett1-0/+5
If an expression returns (e.g.), break, continue or exit, that return code should be propagated, the same it is for [expr {}] Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-27regexp -indices should return character indicesSteve Bennett1-0/+4
Not byte indices Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-27regexp, regsub: -start is a character indexSteve Bennett1-1/+6
Not a byte index Reported-by: dbohdan <dbohdan@dbohdan.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-18file: Add file splitSteve Bennett1-0/+5
This subcommand was missing as it wasn't part of the original Tcl 6.7 Signed-off-by: Steve Bennett <steveb@workware.net.au>