Sha256: 1df18b172f65037089b83c98f9c51b32ae1de99010d1b76e265e7e382ca3a276
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'test/unit' require 'parse_tree' require 'parse_tree_extensions' require 'tmpdir' $: << "../../ruby2ruby/dev/lib" # unoffical dependency - user responsibility require 'ruby2ruby' class R2RTestCase < Test::Unit::TestCase def test_proc_to_ruby util_setup_inline block = proc { puts "something" } assert_equal 'proc { puts("something") }', block.to_ruby end def test_proc_to_sexp util_setup_inline p = proc { 1 + 1 } s = s(:iter, s(:call, nil, :proc, s(:arglist)), nil, s(:call, s(:lit, 1), :+, s(:arglist, s(:lit, 1)))) assert_equal s, p.to_sexp end def test_unbound_method_to_ruby util_setup_inline r = "proc { ||\n util_setup_inline\n p = proc { (1 + 1) }\n s = s(:iter, s(:call, nil, :proc, s(:arglist)), nil, s(:call, s(:lit, 1), :+, s(:arglist, s(:lit, 1))))\n assert_equal(s, p.to_sexp)\n}" m = self.class.instance_method(:test_proc_to_sexp) assert_equal r, m.to_ruby end def util_setup_inline @rootdir = File.join(Dir.tmpdir, "test_ruby_to_ruby.#{$$}") Dir.mkdir @rootdir, 0700 unless test ?d, @rootdir ENV['INLINEDIR'] = @rootdir end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ParseTree-3.0.1-x86-mingw32 | test/test_parse_tree_extensions.rb |
ParseTree-3.0.1-x86-mswin32-60 | test/test_parse_tree_extensions.rb |