aboutsummaryrefslogtreecommitdiff
path: root/tests/jim.test
AgeCommit message (Collapse)AuthorFilesLines
2023-07-10info script: return real current source fileSteve Bennett1-0/+10
And allow current source file to be set Fixes: #268 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-07-04tcltest: rework constraint systemSteve Bennett1-2/+3
Now 'constraint cmd|package' is like 'needs' but sets a constraint The command to 'needs cmd' and 'constraint cmd' can now take a subcommand to check. Add 'constraint|needs eval|expr' to make some constraint checks simpler. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-05-25core: support multi-level while, break from loopsSteve Bennett1-7/+15
loop i 5 { loop j 6 { # This breaks out of both loops break 2 } } Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-03-09expr: TIP 526, only support a single argSteve Bennett1-1/+1
Avoid unexpected issues by concatenating multiple arguments. This does create an incompatibility with early versions, but it is generally trivial to convert existing code to one of two forms: 1. expr {$a + $b} -- usually correct 2. expr "$a + $b" -- usually incorrect Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26core: commands that take an index now use integer expressionsSteve Bennett1-12/+12
This means that instead of just [list index 2+1], we can now do [list index end-$n*2+1] This applies to: lindex, linsert, lreplace, lset, lrange, lsort, regexp, regsub string index,first,last,range Also add tests for both direct integer expressions and indexes. Still needs doc update. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-26core: support integer expressions in various commandsSteve Bennett1-17/+15
For convenience, many commands now accept integer expressions rather than only simple integers. These are: loop, range, incr, string repeat, lrepeat, pack, unpack, rand This simplifies many cases where previously expr {} or $() was required. e.g. foreach i [range 4+1 2*$b] { ... } string repeat 2**$n a Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-12-11list, string: support any number of +/-n for indexSteve Bennett1-0/+28
It is especially convenient to add -1 for something like: lindex $list end-$BACK-1 or: string range $str $p $p+$len-1 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-07lsearch, switch: fix -regexp case with option-like patternSteve Bennett1-0/+9
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-04tests: Add many new additional tests for code coverageSteve Bennett1-7/+58
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-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>
2016-01-18Add the tcl_platform(engine) array element.mistachkin1-0/+3
2014-10-15Add more tcl compatiblitySteve Bennett1-1/+1
- Add wide() function to [expr] (same as int()) - Small error message changes Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-07-26jim.c: make lindex work as identity function.Danyil Bohdan1-3/+7
2013-12-09Fix aio close from non-global namespaceSteve Bennett1-0/+11
aio [open], as well as similar commands return the name of the created command. If this is done in the non-global namespace, the returned name is implicitly scoped to the current namespace while the actual command is created in the global namespace. Thus [close] does not work when invoked in that namespace. The solution is to return a fully qualified name, such as ::aio.handle3 Note that this may also be a problem for similar command such as [proc] and [alias] that return command names. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2012-08-07Remove octal literals with a leading 0 (TIP #114)Steve Bennett1-5/+5
Now an octal literal needs to be explicitly indicated with a leading 0o or 0O, otherwise the number is treated as decimal. This patch also adds support for binary literals. e.g. 0b101 0B1101 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-25Minor message changes to match Tcl 8.6Steve Bennett1-280/+1
And import some up-to-date tests from Tcl 8.6 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-21More constraint improvementsSteve Bennett1-8/+9
2010-12-14Fix constraint checkingSteve Bennett1-3/+3
This was completely wrong. The arg order was wrong such that when test constraints were specifed the test was always skipped! Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-22Overhaul unit test frameworkSteve Bennett1-14/+12
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-17Add UTF-8 support to JimSteve Bennett1-7/+7
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-20Fix some outlier issues with regexp/regsubSteve Bennett1-575/+0
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-15Fix regsub to support strings with embedded nullsSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Skip tests for features which are not availableSteve Bennett1-10/+10
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 Bennett1-0/+4345
And other small testing improvements Signed-off-by: Steve Bennett <steveb@workware.net.au>