Coder Social home page Coder Social logo

mruby-mtest's Introduction

Minimum Test Framework for mruby

Build Status

example

class Test4MTest < MTest::Unit::TestCase
  def test_assert
    assert(true)
    assert(true, 'true sample test')
  end
end

MTest::Unit.new.run

This example outputs results in a format similar to minitest.

You can also use MTest::Unit.new.run to get mruby-test style output. It is OK to use minitest style output with mrbtest. mruby-test will be notified of test runs with either method.

How to use mrbgem's mrbtest

if Object.const_defined?(:MTest)
  class Test4MTest < MTest::Unit::TestCase
    def test_assert_nil
      assert_nil(nil, 'nil sample test')
    end
  end

  if $ok_test
    MTest::Unit.new.mrbtest
  else
    MTest::Unit.new.run
  end
else
  $asserts << "test skip of Test4MTest."  if $asserts
end

TODO

  • MiniTest::Unit.autorun is not implemented (because mruby hasn't at_exit method.)

License

Copyright (c) 2013 Internet Initiative Japan Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

mruby-mtest's People

Contributors

ak-mochi avatar akiray03 avatar drbrain avatar hone avatar ksss avatar ry023 avatar tagomoris avatar take-cheeze avatar tatsushid avatar tsahara avatar yasuyuki avatar yyamano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mruby-mtest's Issues

How to include RegExp?

In mrbtest I get the Skip exception about Regexp not being included:

mtest_unit.rb:183: assert_match is not defined, because Regexp is not impl. (MTest::Skip)

In the gem I'm creating I have the line
spec.add_dependency('mruby-pcre-regexp', :mgem => 'mruby-pcre-regexp')

And in the build spec for test I have this gem included, too.

In the pcre-regexp gem this line is included:
Regexp = PcreRegexp unless Object.const_defined?(:Regexp)

What needs to be done more to have Regexp available in mruby-mtest?

NoMethodError with latest mruby

test/mtest_unit_test.rb failed with latest mruby (mruby/mruby@e6841ab)

% ./tmp/mruby/bin/mruby ./test/mtest_unit_test.rb 

# Running tests:

EEEEEEEEESEE

Finished tests in 0.000843s, 14234.8754 tests/s, 0.0000 assertions/s.

  1) Error:
test_assert_block(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:16:in test_assert_block

  2) Error:
test_assert(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:8:in test_assert

  3) Error:
test_assert_in_delta(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:33:in test_assert_in_delta

  4) Error:
test_assert_include(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:37:in test_assert_include

  5) Error:
test_assert_empty(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:22:in test_assert_empty

  6) Error:
test_assert_equal(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:28:in test_assert_equal

  7) Error:
test_assert_kind_of(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:46:in test_assert_kind_of

  8) Error:
test_assert_instance_of(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:41:in test_assert_instance_of

  9) Error:
test_assert_raise(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:55:in test_assert_raise

 10) Skipped:
test_assert_match(Test4MTest) ./test/mtest_unit_test.rb:51: assert_match is not defined, because Regexp is not impl. (MTest::Skip)

 11) Error:
test_assert_false(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:61:in test_assert_false

 12) Error:
test_assert_true(Test4MTest): NoMethodError, undefined method '_assertions='
	./test/mtest_unit_test.rb:74:in test_assert_true

12 tests, 0 assertions, 0 failures, 11 errors, 1 skips

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.