aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2010-10-20Switch regexp/regsub to use Jim_GetEnum()Steve Bennett1-8/+6
Provides a better error message on wrong args and allows abbreviations. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Fix some outlier issues with regexp/regsubSteve Bennett2-582/+642
Use number of paren expressions with regexp -inline Fix a problem with regexp -start and an anchored search Fix regexp -inline -indices Fix regexp matching with an empty pattern (e.g. ^) Fix some cases where regsub -all did not return all results Fix some regsub cases with an empty pattern Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Add support for lsort -indexSteve Bennett1-0/+193
Also bring in some lsort tests from Tcl Also allow lsort to be reentrant (but not thread safe) Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix regsub to support strings with embedded nullsSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix a concat bugSteve Bennett1-0/+32
If a string ended in backslash-space, the trailing space was lost. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix error message for deleting nonexistent procSteve Bennett1-0/+155
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix some problems with global and upvarSteve Bennett1-0/+323
Redefining a link with upvar or global gave an error. Trying to access a non-existent var via a link gave the wrong error message. Added Tcl upvar tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Portability fixesSteve Bennett1-2/+4
Especially for eCos, mingw32 and cygwin Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Implement 'pid handle'Steve Bennett1-0/+48
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Skip tests for features which are not availableSteve Bennett13-11/+32
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Source location for failed tests was wrongSteve Bennett1-1/+15
That is, tests which didn't fail but did not give the expected result Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Change tree API to be object-basedSteve Bennett1-43/+43
A small change, but makes for a more natural interface Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Use $::env to build environment for execSteve Bennett1-0/+39
Also, switch to using 'sh -c' for the vfork() implementation because it then allows command line redirection, pipes and setting the environment. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add do-nothing fileevent for Tcl compatibilitySteve Bennett1-5/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Don't depend on specific regexp messagesSteve Bennett1-6/+6
These can vary on different systems Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Move test.tcl to tests/jim.testSteve Bennett3-25/+4372
And other small testing improvements Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15eventloop improvements and enhancementsSteve Bennett3-47/+540
Move Jim_EvalObjBackground() out of the core to eventloop Time events are now kept and triggered in time order Time handlers are removed before execution Add 'update' Add 'after info' and 'after idle' Include time events in the return from Jim_ProcessEvents() Add Tcl eventloop tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Fix some eventloop bugsSteve Bennett1-0/+150
bgerror is supposed to be suppressed subsequently if it returns break vwait should error on invalid array element vwait should return an empty result Don't accept 'after info' since it isn't supported Also add some eventloop tests Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Source info was lost when converting source to listSteve Bennett1-16/+17
This meant that the single arg switch case would not give accurate line numbers Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Add 'string is' to JimSteve Bennett1-0/+163
Also, double parsing now allows trailing white space Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett3-138/+39
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Small improvements to testsSteve Bennett5-24/+35
Make exec-9.7 test more reliable Quieten jim tests unless running manually Add jim pipe example Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to tailcallSteve Bennett2-6/+57
Add tests and documentation Make tailcall work within 'try' Fix tailcall interaction with uplevel Use tailcall for dispatch in tree.tcl Also some related improvements in tree.tcl Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Move some core procs into the (Tcl) stdlib extensionSteve Bennett3-1/+144
Also implement 'local' to declare/delete local procs * Add tests/alias.test for testing alias, current, local * proc now returns the name of the proc created * Add helper 'function' to stdlib Reimplement glob and case to use local procs * This keeps these internal procs out of the global namespace Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to 'file mkdir', 'file delete'Steve Bennett1-0/+65
file mkdir will now create intermediate directories file delete can now also delete empty directories Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to catch, return, signal, trySteve Bennett5-60/+148
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-15Add tests for 'file copy'Steve Bennett1-0/+62
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Enhance catch and 'info returncodes'Steve Bennett1-6/+9
*: Add optional arg to catch, opts, like Tcl 8.5 to allow access to the code given by 'return -code' *: Use -- to signify end of options to catch *: 'info returncodes' can give the name of a single code *: Fix 'case' to handle 'return -code' properly
2010-10-15Add basic Tcl implementation of 'try ... finally'Steve Bennett1-0/+65
2010-10-15Improve stack trace handlingSteve Bennett4-23/+146
*: Get rid of JIM_ERR_ADDSTACK and use interp->addStackTrace instead *: 'return -code error' doesn't add a stack frame *: Rename _file_copy to {file copy} for better error messages *: Use 'return -code' to prevent excessive levels in the stack trace Also rename info_nameofexecutable to {info nameofexecutable}
2010-10-15Add exec support for 2>@1Steve Bennett1-0/+4
See TIP #202: http://www.tcl.tk/cgi-bin/tct/tip/202.html
2010-10-15Add Jim_SetResultFormatted() for simplied messagesSteve Bennett2-9/+9
Makes creating error messages much simpler Also convert a couple of long if/else to switch Also some error message improvements Also fix some memory leaks
2010-10-15Implement TIP #288Steve Bennett3-7/+96
See http://www.tcl.tk/cgi-bin/tct/tip/288.html Args and optional args may be to the left of required args
2010-10-15Allow catch to specify what is caughtSteve Bennett2-1/+49
*: 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 Bennett2-1/+22
From Tcl 8.5, implicitly set variable to 0
2010-10-15Simplify and speed up exprSteve Bennett2-1/+8
*: Reuse the ParseTokenList/ScriptToken machinery for 'expr' *: This is simpler than managing separate opcode/obj arrays *: expr opcodes are now in the same namespace as token types *: expr identifies int and double during parsing *: Move the 'while' common expr optimisations into Jim_EvalExpression *: Add a special trueObj and falseObj to help with these boolean optimisations *: Add lazy versions as the byte code is created instead of at the end *: Avoid repeated conversion attempts to int *: Once an object fails conversion to int and succeeds conversion to double, invalidate the string rep so the int conversion attempt no longer happens *: Also, avoid converting non-ints to int in expression optimisation *: No need for a string token for SEP and EOL tokens *: Fix shimmering of int -> double *: When an int shimmers to a double during an expression, remember that the value was originally an int (via a new type, coerced double)
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 Bennett2-22/+21
*: 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 Bennett9-3/+775
*: 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-15More expr tests and fixesSteve Bennett3-8/+598
*: Add tests/expr-new.test from Tcl *: Directly convert from int to double if possible *: Always treat '-' in front of a number as unary minus so that '-0x1234' works. *: Fix expr when the variable does not exist *: Add optional support for math functions *: Also double/0 == Inf or -Inf
2010-10-15New features, docsSteve Bennett3-8/+245
Implement lsearch in C with options *: lsearch -exact, -glob, -regexp, -not, -bool, -all, -inline Add tests for lsearch and expand expr operators: in and ni (Tcl 8.6)
2010-10-15New featuresSteve Bennett1-0/+94
Add unset -nocomplain and tests Implement lrepeat
2010-10-15Simplify expr evaluationSteve Bennett2-6/+8
2010-10-15Fix many problem with expr evaluationSteve Bennett2-1/+892
*: Import Tcl expr tests (expr-old.test) and fix things: *: !double should be boolean (int) *: double&&double and double||double should be boolean (int) *: 2.34e+1 and 2.0e2 are an acceptable double values *: precedence of && and || is not equal *: precedence of ? and : is not equal *: expression "2:3" is invalid *: lazy evaluation involving multiple && and || was quite wrong *: Fix unary minus wrt subexpressions. e.g. -(-1.5) *: Also add support for functions: int, double, abs, round *: Fix lazy evaluation of ternary operator *: Error on missing ?, missing : *: Fix double unary minus *: Add unary plus *: Fix parsing of double with no '.' before 'e'. Also support 'E'. *: Right-to-left associativity of ternary operator is *almost* correct *: Import div/mod of -ve integers from Tcl *: Rotate (<<< and >>>) failed because of wrong arity *: Don't use auto-converted double values *: When an expression fails, show the expression *: Bump version to 0.62
2010-10-15Bugs, features, testsSteve Bennett8-8/+589
Subst was broken for backslash escapes Add support for return, break, continue in subst commands Accept abbreviations for switches to subst Fix 'list #' More tests
2010-10-15Tests, ehancements and bug fixes for execSteve Bennett1-0/+475
Add Tcl tests for exec Fix some errors exposed by these tests Add support for >&, >>&, |&
2010-10-15Source cleanups, typos, add testSteve Bennett4-2/+423