diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
commit | c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/misc/mruby-mtest/test/mtest_unit_test.rb | |
parent | Adding upstream version 1.43.2. (diff) | |
download | netdata-upstream/1.44.3.tar.xz netdata-upstream/1.44.3.zip |
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | web/server/h2o/libh2o/misc/mruby-mtest/test/mtest_unit_test.rb | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/misc/mruby-mtest/test/mtest_unit_test.rb b/web/server/h2o/libh2o/misc/mruby-mtest/test/mtest_unit_test.rb new file mode 100644 index 000000000..43f74cf67 --- /dev/null +++ b/web/server/h2o/libh2o/misc/mruby-mtest/test/mtest_unit_test.rb @@ -0,0 +1,74 @@ +## +# Test of Minimal Test framework for mruby. +# + +if Object.const_defined?(:MTest) + class Test4MTest < MTest::Unit::TestCase + def test_assert + assert(true) + assert(true, 'true sample test') + assert_true(true) + assert_false(false) + assert_nil(nil) + end + + def test_assert_block + assert_block('msg') do + 'something-block' + end + end + + def test_assert_empty + assert_empty('', 'string empty') + assert_empty([], 'array empty') + assert_empty({}, 'hash empty') + end + + def test_assert_equal + assert_equal('', nil.to_s) + assert_not_equal('a', nil.to_s) + end + + def test_assert_in_delta + assert_in_delta(0, 0.1, 0.5) + end + + def test_assert_include + assert_include([1,2,3], 1) + end + + def test_assert_instance_of + assert_instance_of Array, [] + assert_instance_of Class, Array + end + + def test_assert_kind_of + assert_kind_of Array, [] + assert_kind_of Class, Array + end + + def test_assert_match + assert_match 'abc', 'abc' + end + + def test_assert_raise + assert_raise(RuntimeError) do + raise + end + end + + def test_assert_false_failure + assert_raise(MTest::Assertion) do + assert_false(true) + end + end + end + + if $ok_test + MTest::Unit.new.mrbtest + else + MTest::Unit.new.run + end +else + $asserts << "test skip of mruby-mtest/test/mtest_unit_test.rb" if $asserts +end |