Skip to content
Newer
Older
100755 83 lines (72 sloc) 1.08 KB
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
1 #!perl
2
06994a0 Update the files in the repo to add the Parrot Foundation as copyrigh…
arbelo authored Oct 1, 2009
3 # Copyright (C) 2004-2006, The Parrot Foundation.
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
4
5 # the following lines re-execute this as a tcl script
6 # the \ at the end of these lines makes them a comment in tcl \
c34bff7 Tests only need to run from top level build dir.
wcoleda authored May 21, 2009
7 use lib qw(lib); # \
d6ead2c Initial commit from r31638 of https://svn.perl.org/parrot/trunk/langu…
wcoleda authored Oct 7, 2008
8 use Tcl::Test; #\
9 __DATA__
10
11 source lib/test_more.tcl
12 plan 7
13
14 eval_is {
15 catch {unset q}
16 proc a {} {
17 global q
18 return ok
19 }
20 a
21 } ok {missing unreferenced global}
22
23 eval_is {
24 catch {unset q}
25 proc a {} {
26 global q
27 puts $q
28 }
29 a
30 } {can't read "q": no such variable} {missing global}
31
32 eval_is {
33 catch {unset q}
34 proc a {} {
35 global q
36 return $q
37 }
38 set q 2
39 a
40 } 2 {one global}
41
42 eval_is {
43 catch {unset q r s}
44 proc a {} {
45 global q r s
46 return "$q $r $s"
47 }
48 set q 1
49 set r 2
50 set s 3
51 a
52 } {1 2 3} {few globals}
53
54 eval_is {
55 catch {unset a}
56 proc j {} {
57 global a
58 set a 1
59 }
60 j
61 set a
62 } 1 {vivify global}
63
64 eval_is {
65 set a 4
66 proc inca2 {} {
67 global a
68 set a [expr $a + 2]
69 }
70 set b $a
71 inca2
72 list $b $a
73 } {4 6} {changing value}
74
75 eval_is {
76 catch {unset a}
77 proc j {} {
78 global a
79 }
80 j
81 set a
82 } {can't read "a": no such variable} {nonvivifying global}
Something went wrong with that request. Please try again.