Tcl Source Code

Check-in [745068c247]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:test case for [408568] "variable substitution parsing limited to ASCII alphanumerics": illustrating breaking down of dollar-substitution on alnum-unichar.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bug-408568
Files: files | file ages | folders
SHA3-256: 745068c247baddf5505bf6402829a5cb3c223a221437278b2c6c20dfd931d015
User & Date: sebres 2019-03-08 00:34:48.341
Context
2019-03-08
00:44
fixes [408568] "variable substitution parsing limited to ASCII alphanumerics" check-in: 4c5d9c6963 user: sebres tags: bug-408568
00:34
test case for [408568] "variable substitution parsing limited to ASCII alphanumerics": illustrating ... check-in: 745068c247 user: sebres tags: bug-408568
00:04
resolves large discrepancies in proc/lambda between 8.5 and 8.6; coverage for [e3f481f187] regressi... Leaf check-in: fb2b91aea8 user: sebres tags: sebres-8-5-comp-8-6-fix
Changes
Unified Diff Ignore Whitespace Patch
Changes to tests/var.test.
43
44
45
46
47
48
49
50
51
52
53
54
55


56
57
58
59
60
61
62
63
catch {unset xx}
catch {unset x}
catch {unset y}
catch {unset i}
catch {unset a}
catch {unset arr}

test var-1.1 {TclLookupVar, Array handling} {
    catch {unset a}
    set x "incr"  ;# force no compilation and runtime call to Tcl_IncrCmd 
    set i 10
    set arr(foo) 37
    list [$x i] $i [$x arr(foo)] $arr(foo)


} {11 11 38 38}
test var-1.2 {TclLookupVar, TCL_GLOBAL_ONLY implies global namespace var} {
    set x "global value"
    namespace eval test_ns_var {
        variable x "namespace value"
        proc p {} {
            global x  ;# specifies TCL_GLOBAL_ONLY to get global x
            return $x







|





>
>
|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
catch {unset xx}
catch {unset x}
catch {unset y}
catch {unset i}
catch {unset a}
catch {unset arr}

test var-1.1 {TclLookupVar, Array handling} -body {
    catch {unset a}
    set x "incr"  ;# force no compilation and runtime call to Tcl_IncrCmd 
    set i 10
    set arr(foo) 37
    list [$x i] $i [$x arr(foo)] $arr(foo)
} -cleanup {
    unset -nocomplain arr
} -result {11 11 38 38}
test var-1.2 {TclLookupVar, TCL_GLOBAL_ONLY implies global namespace var} {
    set x "global value"
    namespace eval test_ns_var {
        variable x "namespace value"
        proc p {} {
            global x  ;# specifies TCL_GLOBAL_ONLY to get global x
            return $x
210
211
212
213
214
215
216
















217
218
219
220
221
222
223
    list \
	[p] \
	[apply [list [list \u20ac \xe4] {list [set \u20ac] [set \xe4]}] v\u20ac v\xe4] \
	[apply [list [list [list \u20ac v\u20ac] [list \xe4 v\xe4]] {list [set \u20ac] [set \xe4]}]] \
} -cleanup {
    rename p {}
} -result [lrepeat 3 [list v\u20ac v\xe4]]

















test var-2.1 {Tcl_LappendObjCmd, create var if new} {
    catch {unset x}
    lappend x 1 2
} {1 2}

test var-3.1 {MakeUpvar, TCL_NAMESPACE_ONLY not specified for other var} {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
    list \
	[p] \
	[apply [list [list \u20ac \xe4] {list [set \u20ac] [set \xe4]}] v\u20ac v\xe4] \
	[apply [list [list [list \u20ac v\u20ac] [list \xe4 v\xe4]] {list [set \u20ac] [set \xe4]}]] \
} -cleanup {
    rename p {}
} -result [lrepeat 3 [list v\u20ac v\xe4]]

test var-1.30 {TclLookupVar, direct substitution of utf-8 var name} -body {
    namespace eval test_ns_var {
	set vn \u0422\u0438\u043a\u043b\u044c
	set $vn Tcl
	set arr($vn) Tcl-In-Arr
	set ${vn}_${vn}($vn) Tcl-In-Tcl
	list [list [set $vn] [set arr($vn)] [set ${vn}_${vn}($vn)]] \
	     [eval "list \${$vn} \${arr($vn)} \${${vn}_${vn}($vn)}"] \
	     [eval "list \$$vn \$arr($vn) \$${vn}_${vn}($vn)"] \
	     [eval "list \$[namespace current]::$vn \
			    \$[namespace current]::arr($vn) \$[namespace current]::${vn}_${vn}($vn)"]
    }
} -cleanup {
    catch {namespace delete test_ns_var}
} -result [lrepeat 4 {Tcl Tcl-In-Arr Tcl-In-Tcl}]

test var-2.1 {Tcl_LappendObjCmd, create var if new} {
    catch {unset x}
    lappend x 1 2
} {1 2}

test var-3.1 {MakeUpvar, TCL_NAMESPACE_ONLY not specified for other var} {