1 assert_equal '[[1], 2, 3]', '*v1, (a, b) = [1,[2, 3]]; [v1, a, b]'
2 assert_equal '[[1], 2, 3]', '*v1,(*), (a, b) = [1,:x,[2, 3]]; [v1, a, b]'
4 assert_equal '[]', '*a = *nil; a'
5 assert_equal '[nil]', '*a = nil; a'
6 assert_equal '2', 'a, a = 1, 2; a', "[ruby-dev:31522]"
7 assert_equal '[1, 2]', 'a, b = 1, 2'
8 assert_equal '[1, 2]', %q{
10 trace_var(:$a){|v| ans << v}
11 trace_var(:$b){|v| ans << v}
16 assert_equal 'ok', %q{
23 # generated by this script:
29 vals = %w(a b c d e f)
30 vals[i] = '*' + vals[i]
31 program = "#{vals.join(", ")} = *ary"
35 assert_equal "#{ans.inspect}", %q{
37 #{program}; [a, b, c, d, e, f]
43 assert_equal "[[], nil, nil, nil, nil, nil]", %q{
45 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
48 assert_equal "[[], 0, nil, nil, nil, nil]", %q{
50 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
53 assert_equal "[[], 0, 1, nil, nil, nil]", %q{
55 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
58 assert_equal "[[], 0, 1, 2, nil, nil]", %q{
60 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
63 assert_equal "[[], 0, 1, 2, 3, nil]", %q{
65 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
68 assert_equal "[[], 0, 1, 2, 3, 4]", %q{
70 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
73 assert_equal "[[0], 1, 2, 3, 4, 5]", %q{
74 ary = [0, 1, 2, 3, 4, 5]
75 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
78 assert_equal "[[0, 1], 2, 3, 4, 5, 6]", %q{
79 ary = [0, 1, 2, 3, 4, 5, 6]
80 *a, b, c, d, e, f = *ary; [a, b, c, d, e, f]
83 assert_equal "[nil, [], nil, nil, nil, nil]", %q{
85 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
88 assert_equal "[0, [], nil, nil, nil, nil]", %q{
90 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
93 assert_equal "[0, [], 1, nil, nil, nil]", %q{
95 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
98 assert_equal "[0, [], 1, 2, nil, nil]", %q{
100 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
103 assert_equal "[0, [], 1, 2, 3, nil]", %q{
105 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
108 assert_equal "[0, [], 1, 2, 3, 4]", %q{
109 ary = [0, 1, 2, 3, 4]
110 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
113 assert_equal "[0, [1], 2, 3, 4, 5]", %q{
114 ary = [0, 1, 2, 3, 4, 5]
115 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
118 assert_equal "[0, [1, 2], 3, 4, 5, 6]", %q{
119 ary = [0, 1, 2, 3, 4, 5, 6]
120 a, *b, c, d, e, f = *ary; [a, b, c, d, e, f]
123 assert_equal "[nil, nil, [], nil, nil, nil]", %q{
125 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
128 assert_equal "[0, nil, [], nil, nil, nil]", %q{
130 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
133 assert_equal "[0, 1, [], nil, nil, nil]", %q{
135 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
138 assert_equal "[0, 1, [], 2, nil, nil]", %q{
140 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
143 assert_equal "[0, 1, [], 2, 3, nil]", %q{
145 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
148 assert_equal "[0, 1, [], 2, 3, 4]", %q{
149 ary = [0, 1, 2, 3, 4]
150 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
153 assert_equal "[0, 1, [2], 3, 4, 5]", %q{
154 ary = [0, 1, 2, 3, 4, 5]
155 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
158 assert_equal "[0, 1, [2, 3], 4, 5, 6]", %q{
159 ary = [0, 1, 2, 3, 4, 5, 6]
160 a, b, *c, d, e, f = *ary; [a, b, c, d, e, f]
165 assert_equal 'ok', %q{
167 300.times { a<<s; s=s.succ }
171 #{ a.join(",") },*zzz=1
175 }, '[ruby-dev:32581]'
177 assert_equal 'ok', %q{
183 }, '[ruby-dev:32892]'