Projects

Ticket #386: 0001-add-failing-tests-binding-with-block.patch

File 0001-add-failing-tests-binding-with-block.patch, 0.8 KB (added by jazzbox@…, 2 years ago)
  • test_vm/eval.rb

    From 3dbd703511ff5207eeed5adc74989fb2c94cc698 Mon Sep 17 00:00:00 2001
    From: Bernd Ohr <jazzbox@7zz.de>
    Date: Thu, 15 Oct 2009 14:30:42 +0200
    Subject: [PATCH] add failing tests: binding with block
    
    ---
     test_vm/eval.rb |   23 ++++++++++++++++++++++-
     1 files changed, 22 insertions(+), 1 deletions(-)
    
    diff --git a/test_vm/eval.rb b/test_vm/eval.rb
    index 95c581b..85aa271 100644
    a b  
    118118  rescue Exception => e 
    119119  end 
    120120  p e.backtrace.kind_of? Array 
    121 } 
    122  No newline at end of file 
     121} 
     122 
     123assert 'true', %{ 
     124  class Foo 
     125    def get_binding 
     126      binding 
     127    end 
     128  end 
     129  b = Foo.new.get_binding { 42 } 
     130  p eval "block_given?", b 
     131} 
     132 
     133assert '42', %{ 
     134  class Foo 
     135    def get_binding 
     136      binding 
     137    end 
     138  end 
     139  b = Foo.new.get_binding { 42 } 
     140  p eval "yield", b 
     141} 
     142