Report abuse

compiler2/Rakefile


			
$expected_failures = []


namespace 'spec' do
  $failed = $expected_failures.dup

  def add_spec(spec_path)
    unless $expected_failures.include? spec_path
      task spec_path do |t|
        begin
          sh "shotgun/rubinius -Icompiler2 compiler2/test_compile.rb #{spec_path}"
        rescue
          $failed << t.name
        end
      end
      task :language => spec_path
    end
  end

  desc "Run all language specs against compiler2"
  task :language

  Dir.glob('spec/language/*_spec.rb').each do |f|
    add_spec f
  end

  Dir.glob('compiler2/spec/*_spec.rb').each do |f|
    add_spec f
  end

  task :failures => :language do
    puts "*** Failing specs ***"
    $failed.each {|f| puts f}
  end
end

task :default => 'spec:failures'

compiler2/test_compile.rb


			
require 'compiler'
require 'generate'
require 'bytecode'
require 'text'

def compile(file)
  gen = Compiler::Generator
  c = Compiler.new(gen)

  puts "Parsing #{file}"
  begin
    sexp = File.to_sexp(file)
    n = c.into_script(sexp)
    meth = n.to_description
    cm = meth.to_cmethod
    enc = Compiler::Encoder.new
    cm.compile
  rescue
    exit 1
  end
end

compile ARGV.shift