7 assert_equal 'true', 'true'
8 assert_equal 'TrueClass', 'true.class'
9 assert_equal 'false', 'false'
10 assert_equal 'FalseClass', 'false.class'
11 assert_equal '', 'nil'
12 assert_equal 'nil', 'nil.inspect'
13 assert_equal 'NilClass', 'nil.class'
14 assert_equal 'sym', ':sym'
15 assert_equal ':sym', ':sym.inspect'
16 assert_equal 'Symbol', ':sym.class'
17 assert_equal '1234', '1234'
18 assert_equal 'Fixnum', '1234.class'
19 assert_equal '1234', '1_2_3_4'
20 assert_equal 'Fixnum', '1_2_3_4.class'
21 assert_equal '18', '0x12'
22 assert_equal 'Fixnum', '0x12.class'
23 assert_equal '15', '0o17'
24 assert_equal 'Fixnum', '0o17.class'
25 assert_equal '5', '0b101'
26 assert_equal 'Fixnum', '0b101.class'
27 assert_equal '123456789012345678901234567890', '123456789012345678901234567890'
28 assert_equal 'Bignum', '123456789012345678901234567890.class'
29 assert_equal '2.0', '2.0'
30 assert_equal 'Float', '1.3.class'
33 assert_equal 'main', 'self'
34 assert_equal 'Object', 'self.class'
37 assert_equal 'a', '?a'
38 assert_equal 'String', '?a.class'
39 assert_equal 'A', '?A'
40 assert_equal 'String', '?A.class'
41 assert_equal "\n", '?\n'
42 assert_equal 'String', '?\n.class'
43 assert_equal ' ', '?\ '
44 assert_equal 'String', '?\ .class'
45 assert_equal 'string', "'string'"
46 assert_equal 'string', '"string"'
47 assert_equal 'string', '%(string)'
48 assert_equal 'string', '%q(string)'
49 assert_equal 'string', '%Q(string)'
50 assert_equal 'string string', '"string string"'
51 assert_equal ' ', '" "'
52 assert_equal "\0", '"\0"'
53 assert_equal "\1", '"\1"'
54 assert_equal "3", '"\x33"'
55 assert_equal "\n", '"\n"'
57 # dynamic string literal
58 assert_equal '2', '"#{1 + 1}"'
59 assert_equal '16', '"#{2 ** 4}"'
60 assert_equal 'string', 's = "string"; "#{s}"'
62 # dynamic symbol literal
63 assert_equal 'a3c', ':"a#{1+2}c"'
64 assert_equal ':a3c', ':"a#{1+2}c".inspect'
65 assert_equal 'Symbol', ':"a#{1+2}c".class'
68 assert_equal "foo\n", %q(`echo foo`)
69 assert_equal "foo\n", %q(s = "foo"; `echo #{s}`)
72 assert_equal '', '//.source'
73 assert_equal 'Regexp', '//.class'
74 assert_equal '0', '// =~ "a"'
75 assert_equal '0', '// =~ ""'
76 assert_equal 'a', '/a/.source'
77 assert_equal 'Regexp', '/a/.class'
78 assert_equal '0', '/a/ =~ "a"'
79 assert_equal '0', '/test/ =~ "test"'
80 assert_equal '', '/test/ =~ "tes"'
81 assert_equal '0', 're = /test/; re =~ "test"'
82 assert_equal '0', 'str = "test"; /test/ =~ str'
83 assert_equal '0', 're = /test/; str = "test"; re =~ str'
86 assert_equal 'regexp', %q(/re#{'ge'}xp/.source)
87 assert_equal 'Regexp', %q(/re#{'ge'}xp/.class)
90 assert_equal 'Array', '[].class'
91 assert_equal '0', '[].size'
92 assert_equal '0', '[].length'
93 assert_equal '[]', '[].inspect'
94 assert_equal 'Array', '[0].class'
95 assert_equal '1', '[3].size'
96 assert_equal '[3]', '[3].inspect'
97 assert_equal '3', 'a = [3]; a[0]'
98 assert_equal 'Array', '[1,2].class'
99 assert_equal '2', '[1,2].size'
100 assert_equal '[1, 2]', '[1,2].inspect'
101 assert_equal 'Array', '[1,2,3,4,5].class'
102 assert_equal '5', '[1,2,3,4,5].size'
103 assert_equal '[1, 2, 3, 4, 5]', '[1,2,3,4,5].inspect'
104 assert_equal '1', 'a = [1,2]; a[0]'
105 assert_equal '2', 'a = [1,2]; a[1]'
106 assert_equal 'Array', 'a = [1 + 2, 3 + 4, 5 + 6]; a.class'
107 assert_equal '[3, 7, 11]', 'a = [1 + 2, 3 + 4, 5 + 6]; a.inspect'
108 assert_equal '7', 'a = [1 + 2, 3 + 4, 5 + 6]; a[1]'
109 assert_equal '1', '([0][0] += 1)'
110 assert_equal '1', '([2][0] -= 1)'
111 assert_equal 'Array', 'a = [obj = Object.new]; a.class'
112 assert_equal '1', 'a = [obj = Object.new]; a.size'
113 assert_equal 'true', 'a = [obj = Object.new]; a[0] == obj'
114 assert_equal '5', 'a = [1,2,3]; a[1] = 5; a[1]'
115 assert_equal 'bar', '[*:foo];:bar'
116 assert_equal '[1, 2]', 'def nil.to_a; [2]; end; [1, *nil]'
117 assert_equal '[1, 2]', 'def nil.to_a; [1, 2]; end; [*nil]'
118 assert_equal '[0, 1, {2=>3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"
122 assert_equal 'Hash', '{}.class'
123 assert_equal '{}', '{}.inspect'
124 assert_equal 'Hash', '{1=>2}.class'
125 assert_equal '{1=>2}', '{1=>2}.inspect'
126 assert_equal '2', 'h = {1 => 2}; h[1]'
127 assert_equal '0', 'h = {1 => 2}; h.delete(1); h.size'
128 assert_equal '', 'h = {1 => 2}; h.delete(1); h[1]'
129 assert_equal '2', 'h = {"string" => "literal", "goto" => "hell"}; h.size'
130 assert_equal 'literal', 'h = {"string"=>"literal", "goto"=>"hell"}; h["string"]'
131 assert_equal 'hell', 'h = {"string"=>"literal", "goto"=>"hell"}; h["goto"]'
134 assert_equal 'Range', '(1..2).class'
135 assert_equal '1..2', '(1..2).inspect'
136 assert_equal '1', '(1..2).begin'
137 assert_equal '2', '(1..2).end'
138 assert_equal 'false', '(1..2).exclude_end?'
139 assert_equal 'Range', 'r = 1..2; r.class'
140 assert_equal '1..2', 'r = 1..2; r.inspect'
141 assert_equal '1', 'r = 1..2; r.begin'
142 assert_equal '2', 'r = 1..2; r.end'
143 assert_equal 'false', 'r = 1..2; r.exclude_end?'
144 assert_equal 'Range', '(1...3).class'
145 assert_equal '1...3', '(1...3).inspect'
146 assert_equal '1', '(1...3).begin'
147 assert_equal '3', '(1...3).end'
148 assert_equal 'true', '(1...3).exclude_end?'
149 assert_equal 'Range', 'r = (1...3); r.class'
150 assert_equal '1...3', 'r = (1...3); r.inspect'
151 assert_equal '1', 'r = (1...3); r.begin'
152 assert_equal '3', 'r = (1...3); r.end'
153 assert_equal 'true', 'r = (1...3); r.exclude_end?'
154 assert_equal 'Range', 'r = (1+2 .. 3+4); r.class'
155 assert_equal '3..7', 'r = (1+2 .. 3+4); r.inspect'
156 assert_equal '3', 'r = (1+2 .. 3+4); r.begin'
157 assert_equal '7', 'r = (1+2 .. 3+4); r.end'
158 assert_equal 'false', 'r = (1+2 .. 3+4); r.exclude_end?'
159 assert_equal 'Range', 'r = (1+2 ... 3+4); r.class'
160 assert_equal '3...7', 'r = (1+2 ... 3+4); r.inspect'
161 assert_equal '3', 'r = (1+2 ... 3+4); r.begin'
162 assert_equal '7', 'r = (1+2 ... 3+4); r.end'
163 assert_equal 'true', 'r = (1+2 ... 3+4); r.exclude_end?'
164 assert_equal 'Range', 'r = ("a".."c"); r.class'
165 assert_equal '"a".."c"', 'r = ("a".."c"); r.inspect'
166 assert_equal 'a', 'r = ("a".."c"); r.begin'
167 assert_equal 'c', 'r = ("a".."c"); r.end'
169 assert_equal 'String', '__FILE__.class'
170 assert_equal 'Fixnum', '__LINE__.class'
174 assert_equal 'ok', %q{
175 # this cause "called on terminated object".
176 ObjectSpace.each_object(Module) {|m| m.name.inspect }
180 assert_normal_exit %q{
186 }, '[ruby-dev:34524]'
188 assert_normal_exit %q{
190 r = Marshal.load("\x04\bU:\rRational[\ai\x06i\x05")
194 }, '[ruby-dev:34536]'