diff options
author | sebres <sebres@users.sourceforge.net> | 2019-01-30 20:32:18 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2019-01-30 20:32:18 (GMT) |
commit | 8a8e70d5a6a4db9ed214aa5d0b81bf0a63f910cd (patch) | |
tree | 54a11ae8466363c7ef4dc1d25bd34835bf637833 /tests/var.test | |
parent | 3621a3fd746ab2556b36d1250cda4a1ab13529b7 (diff) | |
download | tcl-8a8e70d5a6a4db9ed214aa5d0b81bf0a63f910cd.zip tcl-8a8e70d5a6a4db9ed214aa5d0b81bf0a63f910cd.tar.gz tcl-8a8e70d5a6a4db9ed214aa5d0b81bf0a63f910cd.tar.bz2 |
fixes utf-8 compatibility of proc/lambda arguments (regression on compiled locals/variables containing utf-8 characters) - CompiledLocal::nameLength is length in bytes not in chars everywhere in tcl;
simplest example:
% apply {{€} { set "€" }} 1; # or apply [list \u20ac { set \u20ac }] 1
can't read "€": no such variable
Diffstat (limited to 'tests/var.test')
-rw-r--r-- | tests/var.test | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/var.test b/tests/var.test index 8d86fce..32388a2 100644 --- a/tests/var.test +++ b/tests/var.test @@ -201,6 +201,28 @@ test var-1.18 {TclLookupVar, resurrect array element via upvar to deleted array: test var-1.19 {TclLookupVar, right error message when parsing variable name} -body { [format set] thisvar(doesntexist) } -returnCodes error -result {can't read "thisvar(doesntexist)": no such variable} +test var-1.20 {TclLookupVar, regression on utf-8 variable names} -setup { + proc p [list \u20ac \xe4] {info vars} +} -body { + # test variable with non-ascii name is available (euro and a-uml chars here): + list \ + [p 1 2] \ + [apply [list [list \u20ac \xe4] {info vars}] 1 2] \ + [apply [list [list [list \u20ac \u20ac] [list \xe4 \xe4]] {info vars}]] \ +} -cleanup { + rename p {} +} -result [lrepeat 3 [list \u20ac \xe4]] +test var-1.21 {TclLookupVar, regression on utf-8 variable names} -setup { + proc p [list [list \u20ac v\u20ac] [list \xe4 v\xe4]] {list [set \u20ac] [set \xe4]} +} -body { + # test variable with non-ascii name (and default) is resolvable (euro and a-uml chars here): + 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} |