Skip to content

Commit

Permalink
[Truffle] Add a script to check methods parity with MRI.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Dec 2, 2014
1 parent e58231a commit 3baa2ca
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -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
Expand Down
33 changes: 33 additions & 0 deletions test/truffle/test_methods_parity.rb
@@ -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.