os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/parseOld.test
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
# Commands covered:  set (plus basic command syntax).  Also tests the
sl@0
     2
# procedures in the file tclOldParse.c.  This set of tests is an old
sl@0
     3
# one that predates the new parser in Tcl 8.1.
sl@0
     4
#
sl@0
     5
# This file contains a collection of tests for one or more of the Tcl
sl@0
     6
# built-in commands.  Sourcing this file into Tcl runs the tests and
sl@0
     7
# generates output for errors.  No output means no errors were found.
sl@0
     8
#
sl@0
     9
# Copyright (c) 1991-1993 The Regents of the University of California.
sl@0
    10
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
sl@0
    11
# Copyright (c) 1998-1999 by Scriptics Corporation.
sl@0
    12
#
sl@0
    13
# See the file "license.terms" for information on usage and redistribution
sl@0
    14
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
sl@0
    15
#
sl@0
    16
# RCS: @(#) $Id: parseOld.test,v 1.11.2.1 2003/03/27 13:49:22 dkf Exp $
sl@0
    17
sl@0
    18
if {[lsearch [namespace children] ::tcltest] == -1} {
sl@0
    19
    package require tcltest
sl@0
    20
    namespace import -force ::tcltest::*
sl@0
    21
}
sl@0
    22
sl@0
    23
tcltest::testConstraint testwordend \
sl@0
    24
	[string equal "testwordend" [info commands testwordend]]
sl@0
    25
sl@0
    26
# Save the argv value for restoration later
sl@0
    27
set savedArgv $argv
sl@0
    28
sl@0
    29
proc fourArgs {a b c d} {
sl@0
    30
    global arg1 arg2 arg3 arg4
sl@0
    31
    set arg1 $a
sl@0
    32
    set arg2 $b
sl@0
    33
    set arg3 $c
sl@0
    34
    set arg4 $d
sl@0
    35
}
sl@0
    36
sl@0
    37
proc getArgs args {
sl@0
    38
    global argv
sl@0
    39
    set argv $args
sl@0
    40
}
sl@0
    41
sl@0
    42
# Basic argument parsing.
sl@0
    43
sl@0
    44
test parseOld-1.1 {basic argument parsing} {
sl@0
    45
    set arg1 {}
sl@0
    46
    fourArgs a b	c 		 d
sl@0
    47
    list $arg1 $arg2 $arg3 $arg4
sl@0
    48
} {a b c d}
sl@0
    49
test parseOld-1.2 {basic argument parsing} {
sl@0
    50
    set arg1 {}
sl@0
    51
    eval "fourArgs 123\v4\f56\r7890"
sl@0
    52
    list $arg1 $arg2 $arg3 $arg4
sl@0
    53
} {123 4 56 7890}
sl@0
    54
sl@0
    55
# Quotes.
sl@0
    56
sl@0
    57
test parseOld-2.1 {quotes and variable-substitution} {
sl@0
    58
    getArgs "a b c" d
sl@0
    59
    set argv
sl@0
    60
} {{a b c} d}
sl@0
    61
test parseOld-2.2 {quotes and variable-substitution} {
sl@0
    62
    set a 101
sl@0
    63
    getArgs "a$a b c"
sl@0
    64
    set argv
sl@0
    65
} {{a101 b c}}
sl@0
    66
test parseOld-2.3 {quotes and variable-substitution} {
sl@0
    67
    set argv "xy[format xabc]"
sl@0
    68
    set argv
sl@0
    69
} {xyxabc}
sl@0
    70
test parseOld-2.4 {quotes and variable-substitution} {
sl@0
    71
    set argv "xy\t"
sl@0
    72
    set argv
sl@0
    73
} xy\t
sl@0
    74
test parseOld-2.5 {quotes and variable-substitution} {
sl@0
    75
    set argv "a b	c
sl@0
    76
d e f"
sl@0
    77
    set argv
sl@0
    78
} a\ b\tc\nd\ e\ f
sl@0
    79
test parseOld-2.6 {quotes and variable-substitution} {
sl@0
    80
    set argv a"bcd"e
sl@0
    81
    set argv
sl@0
    82
} {a"bcd"e}
sl@0
    83
sl@0
    84
# Braces.
sl@0
    85
sl@0
    86
test parseOld-3.1 {braces} {
sl@0
    87
    getArgs {a b c} d
sl@0
    88
    set argv
sl@0
    89
} "{a b c} d"
sl@0
    90
test parseOld-3.2 {braces} {
sl@0
    91
    set a 101
sl@0
    92
    set argv {a$a b c}
sl@0
    93
    set b [string index $argv 1]
sl@0
    94
    set b
sl@0
    95
} {$}
sl@0
    96
test parseOld-3.3 {braces} {
sl@0
    97
    set argv {a[format xyz] b}
sl@0
    98
    string length $argv
sl@0
    99
} 15
sl@0
   100
test parseOld-3.4 {braces} {
sl@0
   101
    set argv {a\nb\}}
sl@0
   102
    string length $argv
sl@0
   103
} 6
sl@0
   104
test parseOld-3.5 {braces} {
sl@0
   105
    set argv {{{{}}}}
sl@0
   106
    set argv
sl@0
   107
} "{{{}}}"
sl@0
   108
test parseOld-3.6 {braces} {
sl@0
   109
    set argv a{{}}b
sl@0
   110
    set argv
sl@0
   111
} "a{{}}b"
sl@0
   112
test parseOld-3.7 {braces} {
sl@0
   113
    set a [format "last]"]
sl@0
   114
    set a
sl@0
   115
} {last]}
sl@0
   116
sl@0
   117
# Command substitution.
sl@0
   118
sl@0
   119
test parseOld-4.1 {command substitution} {
sl@0
   120
    set a [format xyz]
sl@0
   121
    set a
sl@0
   122
} xyz
sl@0
   123
test parseOld-4.2 {command substitution} {
sl@0
   124
    set a a[format xyz]b[format q]
sl@0
   125
    set a
sl@0
   126
} axyzbq
sl@0
   127
test parseOld-4.3 {command substitution} {
sl@0
   128
    set a a[
sl@0
   129
set b 22;
sl@0
   130
format %s $b
sl@0
   131
sl@0
   132
]b
sl@0
   133
    set a
sl@0
   134
} a22b
sl@0
   135
test parseOld-4.4 {command substitution} {
sl@0
   136
    set a 7.7
sl@0
   137
    if [catch {expr int($a)}] {set a foo}
sl@0
   138
    set a
sl@0
   139
} 7.7
sl@0
   140
sl@0
   141
# Variable substitution.
sl@0
   142
sl@0
   143
test parseOld-5.1 {variable substitution} {
sl@0
   144
    set a 123
sl@0
   145
    set b $a
sl@0
   146
    set b
sl@0
   147
} 123
sl@0
   148
test parseOld-5.2 {variable substitution} {
sl@0
   149
    set a 345
sl@0
   150
    set b x$a.b
sl@0
   151
    set b
sl@0
   152
} x345.b
sl@0
   153
test parseOld-5.3 {variable substitution} {
sl@0
   154
    set _123z xx
sl@0
   155
    set b $_123z^
sl@0
   156
    set b
sl@0
   157
} xx^
sl@0
   158
test parseOld-5.4 {variable substitution} {
sl@0
   159
    set a 78
sl@0
   160
    set b a${a}b
sl@0
   161
    set b
sl@0
   162
} a78b
sl@0
   163
test parseOld-5.5 {variable substitution} {catch {$_non_existent_} msg} 1
sl@0
   164
test parseOld-5.6 {variable substitution} {
sl@0
   165
    catch {$_non_existent_} msg
sl@0
   166
    set msg
sl@0
   167
} {can't read "_non_existent_": no such variable}
sl@0
   168
test parseOld-5.7 {array variable substitution} {
sl@0
   169
    catch {unset a}
sl@0
   170
    set a(xyz) 123
sl@0
   171
    set b $a(xyz)foo
sl@0
   172
    set b
sl@0
   173
} 123foo
sl@0
   174
test parseOld-5.8 {array variable substitution} {
sl@0
   175
    catch {unset a}
sl@0
   176
    set "a(x y z)" 123
sl@0
   177
    set b $a(x y z)foo
sl@0
   178
    set b
sl@0
   179
} 123foo
sl@0
   180
test parseOld-5.9 {array variable substitution} {
sl@0
   181
    catch {unset a}; catch {unset qqq}
sl@0
   182
    set "a(x y z)" qqq
sl@0
   183
    set $a([format x]\ y [format z]) foo
sl@0
   184
    set qqq
sl@0
   185
} foo
sl@0
   186
test parseOld-5.10 {array variable substitution} {
sl@0
   187
    catch {unset a}
sl@0
   188
    list [catch {set b $a(22)} msg] $msg
sl@0
   189
} {1 {can't read "a(22)": no such variable}}
sl@0
   190
test parseOld-5.11 {array variable substitution} {
sl@0
   191
    set b a$!
sl@0
   192
    set b
sl@0
   193
} {a$!}
sl@0
   194
test parseOld-5.12 {empty array name support} {
sl@0
   195
    list [catch {set b a$()} msg] $msg
sl@0
   196
} {1 {can't read "()": no such variable}}
sl@0
   197
catch {unset a}
sl@0
   198
test parseOld-5.13 {array variable substitution} {
sl@0
   199
    catch {unset a}
sl@0
   200
    set long {This is a very long variable, long enough to cause storage \
sl@0
   201
	allocation to occur in Tcl_ParseVar.  If that storage isn't getting \
sl@0
   202
	freed up correctly, then a core leak will occur when this test is \
sl@0
   203
	run.  This text is probably beginning to sound like drivel, but I've \
sl@0
   204
	run out of things to say and I need more characters still.}
sl@0
   205
    set a($long) 777
sl@0
   206
    set b $a($long)
sl@0
   207
    list $b [array names a]
sl@0
   208
} {777 {{This is a very long variable, long enough to cause storage \
sl@0
   209
	allocation to occur in Tcl_ParseVar.  If that storage isn't getting \
sl@0
   210
	freed up correctly, then a core leak will occur when this test is \
sl@0
   211
	run.  This text is probably beginning to sound like drivel, but I've \
sl@0
   212
	run out of things to say and I need more characters still.}}}
sl@0
   213
test parseOld-5.14 {array variable substitution} {
sl@0
   214
    catch {unset a}; catch {unset b}; catch {unset a1}
sl@0
   215
    set a1(22) foo
sl@0
   216
    set a(foo) bar
sl@0
   217
    set b $a($a1(22))
sl@0
   218
    set b
sl@0
   219
} bar
sl@0
   220
catch {unset a}; catch {unset a1}
sl@0
   221
sl@0
   222
test parseOld-7.1 {backslash substitution} {
sl@0
   223
    set a "\a\c\n\]\}"
sl@0
   224
    string length $a
sl@0
   225
} 5
sl@0
   226
test parseOld-7.2 {backslash substitution} {
sl@0
   227
    set a {\a\c\n\]\}}
sl@0
   228
    string length $a
sl@0
   229
} 10
sl@0
   230
test parseOld-7.3 {backslash substitution} {
sl@0
   231
    set a "abc\
sl@0
   232
def"
sl@0
   233
    set a
sl@0
   234
} {abc def}
sl@0
   235
test parseOld-7.4 {backslash substitution} {
sl@0
   236
    set a {abc\
sl@0
   237
def}
sl@0
   238
    set a
sl@0
   239
} {abc def}
sl@0
   240
test parseOld-7.5 {backslash substitution} {
sl@0
   241
    set msg {}
sl@0
   242
    set a xxx
sl@0
   243
    set error [catch {if {24 < \
sl@0
   244
	35} {set a 22} {set \
sl@0
   245
	    a 33}} msg]
sl@0
   246
    list $error $msg $a
sl@0
   247
} {0 22 22}
sl@0
   248
test parseOld-7.6 {backslash substitution} {
sl@0
   249
    eval "concat abc\\"
sl@0
   250
} "abc\\"
sl@0
   251
test parseOld-7.7 {backslash substitution} {
sl@0
   252
    eval "concat \\\na"
sl@0
   253
} "a"
sl@0
   254
test parseOld-7.8 {backslash substitution} {
sl@0
   255
    eval "concat x\\\n   	a"
sl@0
   256
} "x a"
sl@0
   257
test parseOld-7.9 {backslash substitution} {
sl@0
   258
    eval "concat \\x"
sl@0
   259
} "x"
sl@0
   260
test parseOld-7.10 {backslash substitution} {
sl@0
   261
    eval "list a b\\\nc d"
sl@0
   262
} {a b c d}
sl@0
   263
test parseOld-7.11 {backslash substitution} {
sl@0
   264
    eval "list a \"b c\"\\\nd e"
sl@0
   265
} {a {b c} d e}
sl@0
   266
test parseOld-7.12 {backslash substitution} {
sl@0
   267
    list \ua2
sl@0
   268
} [bytestring "\xc2\xa2"]
sl@0
   269
test parseOld-7.13 {backslash substitution} {
sl@0
   270
    list \u4e21
sl@0
   271
} [bytestring "\xe4\xb8\xa1"]
sl@0
   272
test parseOld-7.14 {backslash substitution} {
sl@0
   273
    list \u4e2k
sl@0
   274
} [bytestring "\xd3\xa2k"]
sl@0
   275
sl@0
   276
# Semi-colon.
sl@0
   277
sl@0
   278
test parseOld-8.1 {semi-colons} {
sl@0
   279
    set b 0
sl@0
   280
    getArgs a;set b 2
sl@0
   281
    set argv
sl@0
   282
} a
sl@0
   283
test parseOld-8.2 {semi-colons} {
sl@0
   284
    set b 0
sl@0
   285
    getArgs a;set b 2
sl@0
   286
    set b
sl@0
   287
} 2
sl@0
   288
test parseOld-8.3 {semi-colons} {
sl@0
   289
    getArgs a b ; set b 1
sl@0
   290
    set argv
sl@0
   291
} {a b}
sl@0
   292
test parseOld-8.4 {semi-colons} {
sl@0
   293
    getArgs a b ; set b 1
sl@0
   294
    set b
sl@0
   295
} 1
sl@0
   296
sl@0
   297
# The following checks are to ensure that the interpreter's result
sl@0
   298
# gets re-initialized by Tcl_Eval in all the right places.
sl@0
   299
sl@0
   300
test parseOld-9.1 {result initialization} {concat abc} abc
sl@0
   301
test parseOld-9.2 {result initialization} {concat abc; proc foo {} {}} {}
sl@0
   302
test parseOld-9.3 {result initialization} {concat abc; proc foo {} $a} {}
sl@0
   303
test parseOld-9.4 {result initialization} {proc foo {} [concat abc]} {}
sl@0
   304
test parseOld-9.5 {result initialization} {concat abc; } abc
sl@0
   305
test parseOld-9.6 {result initialization} {
sl@0
   306
    eval {
sl@0
   307
    concat abc
sl@0
   308
}} abc
sl@0
   309
test parseOld-9.7 {result initialization} {} {}
sl@0
   310
test parseOld-9.8 {result initialization} {concat abc; ; ;} abc
sl@0
   311
sl@0
   312
# Syntax errors.
sl@0
   313
sl@0
   314
test parseOld-10.1 {syntax errors} {catch "set a \{bcd" msg} 1
sl@0
   315
test parseOld-10.2 {syntax errors} {
sl@0
   316
	catch "set a \{bcd" msg
sl@0
   317
	set msg
sl@0
   318
} {missing close-brace}
sl@0
   319
test parseOld-10.3 {syntax errors} {catch {set a "bcd} msg} 1
sl@0
   320
test parseOld-10.4 {syntax errors} {
sl@0
   321
	catch {set a "bcd} msg
sl@0
   322
	set msg
sl@0
   323
} {missing "}
sl@0
   324
#" Emacs formatting >:^(
sl@0
   325
test parseOld-10.5 {syntax errors} {catch {set a "bcd"xy} msg} 1
sl@0
   326
test parseOld-10.6 {syntax errors} {
sl@0
   327
	catch {set a "bcd"xy} msg
sl@0
   328
	set msg
sl@0
   329
} {extra characters after close-quote}
sl@0
   330
test parseOld-10.7 {syntax errors} {catch "set a {bcd}xy" msg} 1
sl@0
   331
test parseOld-10.8 {syntax errors} {
sl@0
   332
	catch "set a {bcd}xy" msg
sl@0
   333
	set msg
sl@0
   334
} {extra characters after close-brace}
sl@0
   335
test parseOld-10.9 {syntax errors} {catch {set a [format abc} msg} 1
sl@0
   336
test parseOld-10.10 {syntax errors} {
sl@0
   337
	catch {set a [format abc} msg
sl@0
   338
	set msg
sl@0
   339
} {missing close-bracket}
sl@0
   340
test parseOld-10.11 {syntax errors} {catch gorp-a-lot msg} 1
sl@0
   341
test parseOld-10.12 {syntax errors} {
sl@0
   342
	catch gorp-a-lot msg
sl@0
   343
	set msg
sl@0
   344
} {invalid command name "gorp-a-lot"}
sl@0
   345
test parseOld-10.13 {syntax errors} {
sl@0
   346
    set a [concat {a}\
sl@0
   347
 {b}]
sl@0
   348
    set a
sl@0
   349
} {a b}
sl@0
   350
sl@0
   351
# The next test will fail on the Mac, 'cause the MSL uses a fixed sized
sl@0
   352
# buffer for %d conversions (LAME!).  I won't leave the test out, however,
sl@0
   353
# since MetroWerks may some day fix this.
sl@0
   354
sl@0
   355
test parseOld-10.14 {syntax errors} {
sl@0
   356
    list [catch {eval \$x[format "%01000d" 0](} msg] $msg $errorInfo
sl@0
   357
} {1 {missing )} {missing )
sl@0
   358
    while executing
sl@0
   359
"$x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000..."
sl@0
   360
    ("eval" body line 1)
sl@0
   361
    invoked from within
sl@0
   362
"eval \$x[format "%01000d" 0]("}}
sl@0
   363
test parseOld-10.15 {syntax errors, missplaced braces} {
sl@0
   364
    catch {
sl@0
   365
        proc misplaced_end_brace {} {
sl@0
   366
            set what foo
sl@0
   367
            set when [expr ${what}size - [set off$what]}]
sl@0
   368
    } msg
sl@0
   369
    set msg
sl@0
   370
} {extra characters after close-brace}
sl@0
   371
test parseOld-10.16 {syntax errors, missplaced braces} {
sl@0
   372
    catch {
sl@0
   373
        set a {
sl@0
   374
            set what foo
sl@0
   375
            set when [expr ${what}size - [set off$what]}]
sl@0
   376
    } msg
sl@0
   377
    set msg
sl@0
   378
} {extra characters after close-brace}
sl@0
   379
test parseOld-10.17 {syntax errors, unusual spacing} {
sl@0
   380
    list [catch {return [ [1]]} msg] $msg
sl@0
   381
} {1 {invalid command name "1"}}
sl@0
   382
# Long values (stressing storage management)
sl@0
   383
sl@0
   384
set a {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH}
sl@0
   385
sl@0
   386
test parseOld-11.1 {long values} {
sl@0
   387
    string length $a
sl@0
   388
} 214
sl@0
   389
test parseOld-11.2 {long values} {
sl@0
   390
    llength $a
sl@0
   391
} 43
sl@0
   392
test parseOld-11.3 {long values} {
sl@0
   393
    set b "1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH"
sl@0
   394
    set b
sl@0
   395
} $a
sl@0
   396
test parseOld-11.4 {long values} {
sl@0
   397
    set b "$a"
sl@0
   398
    set b
sl@0
   399
} $a
sl@0
   400
test parseOld-11.5 {long values} {
sl@0
   401
    set b [set a]
sl@0
   402
    set b
sl@0
   403
} $a
sl@0
   404
test parseOld-11.6 {long values} {
sl@0
   405
    set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH]
sl@0
   406
    string length $b
sl@0
   407
} 214
sl@0
   408
test parseOld-11.7 {long values} {
sl@0
   409
    set b [concat 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH]
sl@0
   410
    llength $b
sl@0
   411
} 43
sl@0
   412
test parseOld-11.8 {long values} {
sl@0
   413
    set b
sl@0
   414
} $a
sl@0
   415
test parseOld-11.9 {long values} {
sl@0
   416
    set a [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ]
sl@0
   417
    llength $a
sl@0
   418
} 62
sl@0
   419
set i 0
sl@0
   420
foreach j [concat 0000 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ] {
sl@0
   421
    set test [string index 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ $i]
sl@0
   422
    set test $test$test$test$test
sl@0
   423
    test parseOld-11.10-[incr i] {long values} {
sl@0
   424
	set j
sl@0
   425
    } $test
sl@0
   426
}
sl@0
   427
test parseOld-11.11 {test buffer overflow in backslashes in braces} {
sl@0
   428
    expr {"a" == {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101\101}}
sl@0
   429
} 0
sl@0
   430
sl@0
   431
test parseOld-12.1 {comments} {
sl@0
   432
    set a old
sl@0
   433
    eval {  # set a new}
sl@0
   434
    set a
sl@0
   435
} {old}
sl@0
   436
test parseOld-12.2 {comments} {
sl@0
   437
    set a old
sl@0
   438
    eval "  # set a new\nset a new"
sl@0
   439
    set a
sl@0
   440
} {new}
sl@0
   441
test parseOld-12.3 {comments} {
sl@0
   442
    set a old
sl@0
   443
    eval "  # set a new\\\nset a new"
sl@0
   444
    set a
sl@0
   445
} {old}
sl@0
   446
test parseOld-12.4 {comments} {
sl@0
   447
    set a old
sl@0
   448
    eval "  # set a new\\\\\nset a new"
sl@0
   449
    set a
sl@0
   450
} {new}
sl@0
   451
sl@0
   452
test parseOld-13.1 {comments at the end of a bracketed script} {
sl@0
   453
    set x "[
sl@0
   454
expr 1+1
sl@0
   455
# skip this!
sl@0
   456
]"
sl@0
   457
} {2}
sl@0
   458
sl@0
   459
test parseOld-14.1 {TclWordEnd procedure} {testwordend} {
sl@0
   460
    testwordend " 	\n abc"
sl@0
   461
} {c}
sl@0
   462
test parseOld-14.2 {TclWordEnd procedure} {testwordend} {
sl@0
   463
    testwordend "   \\\n"
sl@0
   464
} {}
sl@0
   465
test parseOld-14.3 {TclWordEnd procedure} {testwordend} {
sl@0
   466
    testwordend "   \\\n "
sl@0
   467
} { }
sl@0
   468
test parseOld-14.4 {TclWordEnd procedure} {testwordend} {
sl@0
   469
    testwordend {"abc"}
sl@0
   470
} {"}
sl@0
   471
#" Emacs formatting >:^(
sl@0
   472
test parseOld-14.5 {TclWordEnd procedure} {testwordend} {
sl@0
   473
    testwordend {{xyz}}
sl@0
   474
} \}
sl@0
   475
test parseOld-14.6 {TclWordEnd procedure} {testwordend} {
sl@0
   476
    testwordend {{a{}b{}\}} xyz}
sl@0
   477
} "\} xyz"
sl@0
   478
test parseOld-14.7 {TclWordEnd procedure} {testwordend} {
sl@0
   479
    testwordend {abc[this is a]def ghi}
sl@0
   480
} {f ghi}
sl@0
   481
test parseOld-14.8 {TclWordEnd procedure} {testwordend} {
sl@0
   482
    testwordend "puts\\\n\n  "
sl@0
   483
} "s\\\n\n  "
sl@0
   484
test parseOld-14.9 {TclWordEnd procedure} {testwordend} {
sl@0
   485
    testwordend "puts\\\n   	"
sl@0
   486
} "s\\\n   	"
sl@0
   487
test parseOld-14.10 {TclWordEnd procedure} {testwordend} {
sl@0
   488
    testwordend "puts\\\n   	xyz"
sl@0
   489
} "s\\\n   	xyz"
sl@0
   490
test parseOld-14.11 {TclWordEnd procedure} {testwordend} {
sl@0
   491
    testwordend {a$x.$y(a long index) foo}
sl@0
   492
} ") foo"
sl@0
   493
test parseOld-14.12 {TclWordEnd procedure} {testwordend} {
sl@0
   494
    testwordend {abc; def}
sl@0
   495
} {; def}
sl@0
   496
test parseOld-14.13 {TclWordEnd procedure} {testwordend} {
sl@0
   497
    testwordend {abc def}
sl@0
   498
} {c def}
sl@0
   499
test parseOld-14.14 {TclWordEnd procedure} {testwordend} {
sl@0
   500
    testwordend {abc	def}
sl@0
   501
} {c	def}
sl@0
   502
test parseOld-14.15 {TclWordEnd procedure} {testwordend} {
sl@0
   503
    testwordend "abc\ndef"
sl@0
   504
} "c\ndef"
sl@0
   505
test parseOld-14.16 {TclWordEnd procedure} {testwordend} {
sl@0
   506
    testwordend "abc"
sl@0
   507
} {c}
sl@0
   508
test parseOld-14.17 {TclWordEnd procedure} {testwordend} {
sl@0
   509
    testwordend "a\000bc"
sl@0
   510
} {c}
sl@0
   511
test parseOld-14.18 {TclWordEnd procedure} {testwordend} {
sl@0
   512
    testwordend \[a\000\]
sl@0
   513
} {]}
sl@0
   514
test parseOld-14.19 {TclWordEnd procedure} {testwordend} {
sl@0
   515
    testwordend \"a\000\"
sl@0
   516
} {"}
sl@0
   517
#" Emacs formatting >:^(
sl@0
   518
test parseOld-14.20 {TclWordEnd procedure} {testwordend} {
sl@0
   519
    testwordend a{\000}b
sl@0
   520
} {b}
sl@0
   521
test parseOld-14.21 {TclWordEnd procedure} {testwordend} {
sl@0
   522
    testwordend "   \000b"
sl@0
   523
} {b}
sl@0
   524
sl@0
   525
test parseOld-15.1 {TclScriptEnd procedure} {
sl@0
   526
    info complete {puts [
sl@0
   527
	expr 1+1
sl@0
   528
	#this is a comment ]}
sl@0
   529
} {0}
sl@0
   530
test parseOld-15.2 {TclScriptEnd procedure} {
sl@0
   531
    info complete "abc\\\n"
sl@0
   532
} {0}
sl@0
   533
test parseOld-15.3 {TclScriptEnd procedure} {
sl@0
   534
    info complete "abc\\\\\n"
sl@0
   535
} {1}
sl@0
   536
test parseOld-15.4 {TclScriptEnd procedure} {
sl@0
   537
    info complete "xyz \[abc \{abc\]"
sl@0
   538
} {0}
sl@0
   539
test parseOld-15.5 {TclScriptEnd procedure} {
sl@0
   540
    info complete "xyz \[abc"
sl@0
   541
} {0}
sl@0
   542
sl@0
   543
# cleanup
sl@0
   544
set argv $savedArgv
sl@0
   545
::tcltest::cleanupTests
sl@0
   546
return