From cf4d848cad87f4ee537b79cdf0ae32684b88f165 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 13 Jan 2025 15:30:30 -0500 Subject: [ruby/mmtk] Add framework for tests https://github.com/ruby/mmtk/commit/6d94549fc7 --- test/mmtk/helper.rb | 21 +++++++++++++++++++++ test/mmtk/test_configuration.rb | 16 ++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/mmtk/helper.rb create mode 100644 test/mmtk/test_configuration.rb diff --git a/test/mmtk/helper.rb b/test/mmtk/helper.rb new file mode 100644 index 0000000000..e4cff30389 --- /dev/null +++ b/test/mmtk/helper.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require "test/unit" +require "core_assertions" + +module MMTk + class TestCase < ::Test::Unit::TestCase + include Test::Unit::CoreAssertions + + def setup + omit "Not running on MMTk" unless using_mmtk? + super + end + + private + + def using_mmtk? + GC.config[:implementation] == "mmtk" + end + end +end diff --git a/test/mmtk/test_configuration.rb b/test/mmtk/test_configuration.rb new file mode 100644 index 0000000000..1191a27e6d --- /dev/null +++ b/test/mmtk/test_configuration.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +require_relative "helper" +module MMTk + class TestConfiguration < TestCase + def test_invalid_MMTK_THREADS + exit_code = assert_in_out_err( + [{ "MMTK_THREADS" => "foobar" }, "--"], + "", + [], + ["[FATAL] Invalid MMTK_THREADS foobar"] + ) + + assert_equal(1, exit_code.exitstatus) + end + end +end -- cgit v1.2.3