Fix all but one test
Riples upon riples. The one left looks like the genuine article
This commit is contained in:
25
test/rubyx/parfait/README.md
Normal file
25
test/rubyx/parfait/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Test Parfait compilation
|
||||
|
||||
Parfait has tests in tests/parfait which test it using mri.
|
||||
|
||||
## Parsing and compiling Parfait
|
||||
|
||||
Since we need Parfait in the runtime, we need to parse it and compile it.
|
||||
And since it is early days, we expect errors at every level during this process, which
|
||||
means testing every layer for every file.
|
||||
|
||||
Rather than create parfait tests for every layer (ie in the vool/mom/risc directories)
|
||||
we have one file per parfait file here. Each file tests all layers.
|
||||
|
||||
The usual workflow is to start with a new file and create tests for vool, mom, risc,binary
|
||||
in that order. Possibly fixing the compiler on the way. Then adding the file to
|
||||
the RubyXCompiler parfait load list.
|
||||
|
||||
## Testing compiled Parfait
|
||||
|
||||
The next step is to test the compiled parfait. Since we have tests, the best way would
|
||||
be to parse and execute the tests. This would involve creating a mini MiniTest and some
|
||||
fancy footwork in the compilation. But it should be possible to create one executable /
|
||||
interpreted test for each of the exising Parfait test.
|
||||
|
||||
Alas, this is for another day.
|
13
test/rubyx/parfait/helper.rb
Normal file
13
test/rubyx/parfait/helper.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module RubyX
|
||||
module ParfaitHelper
|
||||
|
||||
def load_parfait(file)
|
||||
File.read File.expand_path("../../../../lib/parfait/#{file}.rb",__FILE__)
|
||||
end
|
||||
def compiler
|
||||
RubyXCompiler.new(RubyX.default_test_options)
|
||||
end
|
||||
end
|
||||
end
|
25
test/rubyx/parfait/test_object.rb
Normal file
25
test/rubyx/parfait/test_object.rb
Normal file
@ -0,0 +1,25 @@
|
||||
require_relative "helper"
|
||||
|
||||
module RubyX
|
||||
|
||||
class TestObjecCompile < MiniTest::Test
|
||||
include ParfaitHelper
|
||||
def source
|
||||
load_parfait(:object2)
|
||||
end
|
||||
def test_load
|
||||
assert source.include?("class Object")
|
||||
assert source.length > 2000
|
||||
end
|
||||
def est_vool
|
||||
vool = compiler.ruby_to_vool source
|
||||
assert_equal Vool::ClassStatement , vool.class
|
||||
assert_equal :Object , vool.name
|
||||
end
|
||||
def est_mom
|
||||
vool = compiler.ruby_to_mom source
|
||||
assert_equal Vool::ClassStatement , vool.class
|
||||
assert_equal :Object , vool.name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user