Sha256: 37b3ecedd06eea7ea9926791e023bd12e9a4311ac4ee26594991695e446e8d07
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
require 'test/unit' require 'rbconfig' dir = File.dirname(__FILE__) $:.unshift(dir) if not $:.include?(dir) $:.unshift("#{dir}/../lib") if not $:.include?("#{dir}/../lib") $:.unshift("#{dir}/../ext") if not $:.include?("#{dir}/../ext") require 'internal/proc' $stdout.sync = true $stderr.sync = true class TC_Node < Test::Unit::TestCase def initialize(test_method_name) # TODO: This seems to be the only way to get tests defined with # # define_method to run on 1.8.1 and earlier. catch(:invalid_test) { super(test_method_name) } end def test_marshal_proc p = proc { 1 + 1 } d = Marshal.dump(p) u = Marshal.load(d) p2 = u.bind(binding) assert_equal(p.call, p2.call) end def test_proc_unbind p = proc { 1 + 1 } u = p.unbind p2 = u.bind(binding) assert_equal(p.call, p2.call) end if not defined?(RubyVM) then define_method(:test_proc_body) do p = proc { 1 + 1 } assert_equal p.call, p.body.eval(self) end end end if __FILE__ == $0 then exit Test::Unit::AutoRunner.run end
Version data entries
11 entries across 11 versions & 1 rubygems