aboutsummaryrefslogtreecommitdiff
path: root/tests/misc.test
AgeCommit message (Collapse)AuthorFilesLines
2023-08-13tests: misc: improve 'info statics' testSteve Bennett1-3/+5
To show that it returns the current values, not just the original values Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-06-21core: Display errors in a more "pythonesque" waySteve Bennett1-7/+6
A typical error message now looks like this: t4.tcl:2: Error: syntax error in expression: "blah" Traceback (most recent call last): File "t4.tcl", line 14 c 1 2 3 File "t4.tcl", line 10, in c b a c File "t4.tcl", line 6, in b a A14 File "t4.tcl", line 2, in a expr blah This is produced by stackdump (that can be replaced), called by errorInfo. Note that now stacktraces (stacktrace, info stacktrace, $opts(-errorinfo)) include the running command at each level in addition to proc, file, line. In order for scripts to detect this new format, a new entry tcl_platform entry has been added: tcl_platform(stackFormat) = 4 (to signify 4 elements per frame) In addition, instead of building the error stack frame as the stack is unwound in response to an error, instead the entire current stack trace is captured by stacktrace. This means that the trace extends beyond the try/catch right back to the initial interpreter command. The 'stacktrace' command is now implemented in C based on the same code that generates the error stacktrace. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-10-31core: change "newVal" to "value" in [lset] usageD. Bohdan1-1/+1
2020-10-31core: put space before "..." in "wrong # args" msgD. Bohdan1-0/+5
Resolves #173.
2020-06-05core: variable names may now contain embedded nullsSteve Bennett1-6/+6
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-06exit: Set the exit code as the interp resultSteve Bennett1-2/+2
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>
2019-12-13tests: Fix misc.test for new return -level 0 behaviourSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-08-03Error on extra characters after close braceSteve Bennett1-1/+1
In scripts, like Tcl does. Signed-off-by: Steve Bennett <steveb@workware.net.au> Reported-by: tcler.yin
2017-05-30expr: Ensure that non-zero return codes are passed throughSteve Bennett1-0/+13
Non-zero return codes (e.g. break, continue, exit) were all being converted to the error code. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-04-07expr: Add better checks for invalid ternary expressionSteve Bennett1-1/+1
Reported-by: Ryan Whitworth <me@ryanwhitworth.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2015-04-06Avoid error in tcltest.tcl if $::argv0 is unsetSteve Bennett1-1/+1
Can happen if running interactively or via -e Reported-by: Stuart Cassoff <stwo@bell.net> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2013-12-21Fix hash table order dependency in various testsSteve Bennett1-3/+9
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-25Add [info statics]Steve Bennett1-0/+6
To access static variables (names and values) of a proc Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-24Fix script ignored string rep after list operationSteve Bennett1-0/+8
Even if a string has list rep internally, the original string rep (if there is one) should be used when evaluated as a script. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-08Fix missing expr error message with || and &&Steve Bennett1-0/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-05-24Small code cleanupsSteve Bennett1-4/+72
Remove Jim_SetWide() since it is only used by incr More tests for better test coverage Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-05-23Improve list parsingSteve Bennett1-0/+107
Also add additional tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-15Fix an object sharing bug for arraysSteve Bennett1-0/+28
Commands which modify variables in place such as append, lappend, incr and lset did not correctly account for modifying a shared array through an array element (dict sugar). Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-14Include all double colons as part of the var nameSteve Bennett1-0/+7
e.g. $::a::b is considered as ${::a::b} This helps be more Tcl compatible by allowing fake namespace variables Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-06Add more dependencies for testsSteve Bennett1-0/+2
Allow tests to run with almost all features disabled
2010-11-22Overhaul unit test frameworkSteve Bennett1-10/+4
Much closer to tcltest now, including constraints. Try to get all appropriate tests running under both Jim and Tcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-19Better Tcl compatibility for [lrepeat]Steve Bennett1-6/+4
With zero count and also with no list elements Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17Bug fix: [split] string with leading nullSteve Bennett1-0/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-17Add UTF-8 support to JimSteve Bennett1-0/+3
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Skip tests for features which are not availableSteve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to catch, return, signal, trySteve Bennett1-0/+33
Improve the ability to rethrow errors * Allow return to rethrow an error by accepting '-errorinfo stacktrace' * Also, 'catch ... opts' now also stores opts(-errorinfo) on error * Use these to provide better stack traces from 'case' and 'try' * Implement 'return -level' Make try/on/finally more Tcl 8.6 compatible * With support for 'on' handlers and docs Add support for catch options to try * Otherwise it's hard to use try to catch signals Improvements to signal handling * catch -signal now sets a list of the handled signals as the result * catch -signal won't execute the body at all if a handled signal is pending * up to 64 (jim_wide) signals can now be handled * if catch -signal is nested, the innermost catch will catch the error * new 'signal catch' allows ignored/blocked signals to be examined and cleared. * update docs on signal handling exec should indicate which signal killed the child Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix lassign to work properly with an empty listSteve Bennett1-0/+6
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix 'format %%'Steve Bennett1-0/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Allow catch to specify what is caughtSteve Bennett1-0/+48
*: Default to the same as Tcl. Not signal, eval, exit. *: Use 'catch -exit' to also catch exit. *: Also map for standard return codes: [info returncodes] *: Also Jim_ReturnCode() *: Add Jim_FindByName() for searching in a char* array *: Fix 'info nameofexectutable' if $::jim_argv0 is not set
2010-10-15Allow incr on unset variableSteve Bennett1-0/+21
From Tcl 8.5, implicitly set variable to 0
2010-10-15Fix null pointer dereferenceSteve Bennett1-0/+10
If the condition expression of a for statement is invalid
2010-10-15Bug fixes and featuresSteve Bennett1-14/+18
Support end+<n> index And generally simplify the index handling Add support for 'info nameofexecutable'
2010-10-15Rework script/subst parser for improved performanceSteve Bennett1-18/+18
*: Keep abc(def) as a single token, but split abc($def) into 4 tokens *: Then optimise when interpolating to keep a reference to the underlying objects *: This speeds up the 'set a($b)' case a lot *: Also avoid so much alloc/realloc when parsing scripts and subst objects Also simplify cmdStruct creation *: Can omit args=-1 for expand *: Makes it easy to calculate the length *: Do it all in a single loop for simplicity, size and speed
2010-10-15Many improvements, bug fixesSteve Bennett1-1/+78
*: Allow math functions to be enabled via configure *: Allow support for references to be removed *: Documentation updates *: Jim_ListLength() now returns the result directly *: Optimise list -> dict conversion *: Consistent capitalisation of some structures, functions *: Add support for abbreviations to Jim_GetEnum() *: The commands to 'info' may be abbreviated *: Use abbreviation support in parsing options to 'subst' *: Use Jim_GetEnum() to parse return code names *: Optimise 'array get', 'array set' if no conversion needed *: Import Tcl string.test *: string compare now returns -1,0,1 like Tcl *: Fix 'string last' with index=0 *: Add support for 'string reverse' *: Add -nocase option to 'string equal' *: Fix infinite loop in 'string repeat str -1' *: Support braced patterns in glob *: glob should not return dot files unless the pattern starts with . *: Simplify glob.tcl by using some new features *: When creating C extensions from Tcl, preserve newlines and invoke with Jim_Eval_Named() to produce more meaningful error messages. *: Also remove all comments, not just those starting in the first column *: Add support for 'n+n' and 'n-n' in string/list indexes (Tcl 8.5) *: Add a level to the stack trace for 'return -code error' *: 'return -code' should also affect the return from 'source' (see Tcl docs) *: Fix lsort -command *: Some systems don't have INFINITY
2010-10-15New featuresSteve Bennett1-0/+94
Add unset -nocomplain and tests Implement lrepeat
2010-10-15Source cleanups, typos, add testSteve Bennett1-0/+10
2010-10-15Bug fixes, documentation updatesSteve Bennett1-0/+24
jimsh - retry on EINTR from fgets() Fix 0 -> NULL for 64 bit systems Fix overlapping memcpy Fix jim array dereferencing bug *: Counting of parentheses was incorrect with nested array references *: The result for array dereference wasn't being used properly Add os.uptime command Documentation: autogenerated command index Fix gets when last line has no newline