5 if /mswin32/ !~ RUBY_PLATFORM
10 $matzruby = Config::CONFIG['ruby_install_name']
13 if /\Aruby=(.+)/ =~ opt
15 elsif /\Amatzruby=(.+)/ =~ opt
20 a = "matzruby: #{`#{$matzruby} -v`}"
21 b = "ruby : #{`#{$ruby} -v`}"
23 raise "Using same command" if a == b
25 class YarvTestBase < Test::Unit::TestCase
44 def exec exec_file, program
46 dir << ENV['RAMDISK'] if ENV['RAMDISK']
47 tmpf = Tempfile.new("yarvtest_#{Process.pid}_#{Time.now.to_i}", *dir)
50 result = `#{exec_file} #{tmpf.path}`
56 def dump_and_exec exec_file, str
58 iseq = YARVCore::InstructionSequence.compile(<<-'EOS__')
61 p YARVCore::InstructionSequence.load(iseq.to_a).eval
64 exec(exec_file, asmstr)
67 def exec_ exec_file, program
68 exec_file.tr!('\\', '/')
70 IO.popen("#{exec_file}", 'r+'){|io|
93 matzruby = exec($matzruby, evalstr)
94 ruby = exec($ruby, evalstr)
97 puts "matzruby (#$matzruby): #{matzruby}"
98 puts "ruby (#$ruby): #{ruby}"
101 assert_equal(matzruby.gsub(/\r/, ''), ruby.gsub(/\r/, ''), str)
105 yarvasm = dump_and_exec($ruby, str)
106 assert_equal(ruby.gsub(/\r/, ''), yarvasm.gsub(/\r/, ''))