1 assert_equal %q{ok}, %q{
9 assert_equal %q{[:ok, :ok2]}, %q{
18 assert_equal %q{[nil, 1]}, %q{
32 assert_equal %q{C}, %q{
40 eval('Const', C.new.m)
42 assert_equal %q{top}, %q{
48 eval('Const', TOPLEVEL_BINDING)
65 assert_equal %q{ok}, %q{
73 assert_equal %q{C}, %q{
79 C.new.foo.eval("self.class.to_s")
81 assert_equal %q{1}, %q{
84 assert_equal %q{1}, %q{
87 assert_equal %q{1}, %q{
91 assert_equal %q{ok}, %q{
96 assert_equal %q{ok}, %q{
97 1.__send__ :instance_eval, %{
101 assert_equal %q{1}, %q{
106 assert_equal %q{foo}, %q{
111 assert_equal %q{1}, %q{
119 assert_equal %q{C}, %q{
128 assert_equal %q{C}, %q{
140 assert_equal %q{C}, %q{
152 assert_equal %q{[:top, :C, :top, :C]}, %q{
163 Boo = false unless defined? Boo
173 assert_equal %q{[10, main]}, %q{
192 %w[break next redo].each do |keyword|
193 assert_match %r"Can't escape from eval with #{keyword}\z", %{
195 eval "0 rescue #{keyword}"
196 rescue SyntaxError => e
199 }, '[ruby-dev:31372]'
202 assert_normal_exit %q{
203 STDERR.reopen(STDOUT)
206 class_eval("def some-bad-name; puts 'hello' unless @some_variable.some_function(''); end")
210 }, '[ruby-core:14556] reported by Frederick Cheung'
212 assert_equal 'ok', %q{
214 def my_module_eval(&block)
219 Integer.my_module_eval do
223 if Integer.instance_methods(false).map{|m|m.to_sym}.include?(:hoge) &&
224 !String.instance_methods(false).map{|m|m.to_sym}.include?(:hoge)
229 }, "[ruby-dev:34236]"
231 assert_equal 'ok', %q{
233 eval("class nil::Foo; end")
240 assert_equal 'ok', %q{
242 0.instance_eval { def m() :m end }
248 }, '[ruby-dev:34579]'
250 assert_equal 'ok', %q{
252 12.instance_eval { @@a }
256 }, '[ruby-core:16794]'
258 assert_equal 'ok', %q{
260 12.instance_exec { @@a }
264 }, '[ruby-core:16794]'
266 assert_equal 'ok', %q{
274 }, '[ruby-core:16796]'
276 assert_equal 'ok', %q{
284 }, '[ruby-core:16796]'
286 assert_normal_exit %q{
287 eval("", method(:proc).call {}.binding)