File: var2.t

package info (click to toggle)
libtcl-perl 1.32%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: perl: 417; tcl: 19; makefile: 14
file content (30 lines) | stat: -rw-r--r-- 534 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Check for correct iterating over hash tied to a Tcl array
# containing an element with the empty string as its name
use warnings;
use strict;
use Test;

BEGIN {
    $| = 1;
    plan tests => 4;
}

use Tcl;

my $i = new Tcl;
$i->Init;

tie my %h, 'Tcl::Var', $i, 'myarray';
$i->Eval(<<'EOS');
array set myarray {
    a  1
    {} 2
    b  3
}
EOS

my @k = sort keys(%h);
ok(@k, 3, 'correct keys(%h) length');
ok($k[0], '',  q/keys(%h) contains ''/);
ok($k[1], 'a', q/keys(%h) contains 'a'/);
ok($k[2], 'b', q/keys(%h) contains 'b'/);