Skip to content

Instantly share code, notes, and snippets.

@scalone
Created July 25, 2013 21:51
Show Gist options
  • Save scalone/6084110 to your computer and use it in GitHub Desktop.
Save scalone/6084110 to your computer and use it in GitHub Desktop.
Test case and Test helper sample to abstract test interface in mtest(MRuby) and test/unit(MRI)
class TestHelper
if Object.const_defined?(:MTest)
def self.case
engine::TestCase
end
def self.engine
MTest::Unit
end
def self.run
engine.new.run
end
else
require 'test/unit'
require File.dirname(__FILE__) + '/../lib/sample.rb'
def self.case
engine::TestCase
end
def self.engine
Test::Unit
end
end
end
class Test4MTest < TestHelper.case
def test_assert
assert(true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment