Skip to content
Permalink
Browse files
[Truffle] Add a script to check methods parity with MRI.
  • Loading branch information
eregon committed Dec 2, 2014
1 parent e58231a commit 3baa2ca372862f5d3c16e2271369deeb07ba2baa
Showing with 34 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +33 −0 test/truffle/test_methods_parity.rb
@@ -66,6 +66,7 @@ target
test/prawn
test/rails
test/testapp/testapp
test/truffle/*.methods
tool/nailgun/Makefile
tool/nailgun/config.log
tool/nailgun/config.status
@@ -0,0 +1,33 @@
=begin
Run first with JRuby+Truffle, then with MRI:
$ .../jruby -X+T test_methods_parity.rb > truffle.methods
$ .../ruby test_methods_parity.rb truffle.methods > mri.methods
Compare with:
$ git diff -U10 --no-index mri.methods truffle.methods
Red is what we don't implement yet,
Green is methods not existing in MRI (which should be fixed!)
=end

start = BasicObject # Numeric

modules = Object.constants.sort.map { |c|
Object.const_get(c)
}.select { |v|
Module === v and !v.instance_methods(false).empty?
}.select { |mod|
!mod.name.end_with?("Error")
}.select { |mod|
mod <= start
}

if RUBY_ENGINE == "ruby" and truffle_file = ARGV.first
truffle_modules = File.readlines(truffle_file).map(&:chomp).grep(/^[A-Z]/)
modules = modules.select { |mod| truffle_modules.include? mod.name }
end

modules.each do |mod|
puts
puts mod.name
puts mod.instance_methods(false).sort
end

0 comments on commit 3baa2ca

Please sign in to comment.