Class: MesaTestCase
- Inherits:
-
Object
- Object
- MesaTestCase
- Defined in:
- lib/mesa_test.rb
Instance Attribute Summary collapse
-
#mesa ⇒ Object
readonly
Returns the value of attribute mesa.
-
#mod ⇒ Object
readonly
Returns the value of attribute mod.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
-
#test_name ⇒ Object
readonly
Returns the value of attribute test_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#do_one ⇒ Object
just punt to
each_test_runin the test_suite directory. -
#err_64 ⇒ Object
Base-64 encoded contents of err.txt file.
-
#initialize(test: nil, mesa: nil, mod: nil, position: nil) ⇒ MesaTestCase
constructor
A new instance of MesaTestCase.
-
#mk_64 ⇒ Object
Base-64 encoded contents of mk.txt file.
-
#out_64 ⇒ Object
Base-64 encoded contents of out.txt file.
-
#passed? ⇒ Boolean
whether or not a test case has passed; only has meaning if we can load the results hash, though.
-
#ran? ⇒ Boolean
rough proxy for whether or not the test has even been run.
- #results_hash ⇒ Object
- #test_case_dir ⇒ Object
- #test_suite_dir ⇒ Object
- #testhub_file ⇒ Object
Constructor Details
#initialize(test: nil, mesa: nil, mod: nil, position: nil) ⇒ MesaTestCase
Returns a new instance of MesaTestCase.
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File 'lib/mesa_test.rb', line 957 def initialize(test: nil, mesa: nil, mod: nil, position: nil) @test_name = test @mesa = mesa unless MesaTestCase.modules.include? mod raise TestCaseDirError, "Invalid module: #{mod}. Must be one of: " + MesaTestCase.modules.join(', ') end @mod = mod @position = position # way to output colored text to shell @shell = Thor::Shell::Color.new # validate stuff check_mesa_dir check_test_case end |
Instance Attribute Details
#mesa ⇒ Object (readonly)
Returns the value of attribute mesa.
951 952 953 |
# File 'lib/mesa_test.rb', line 951 def mesa @mesa end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
951 952 953 |
# File 'lib/mesa_test.rb', line 951 def mod @mod end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
951 952 953 |
# File 'lib/mesa_test.rb', line 951 def position @position end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
951 952 953 |
# File 'lib/mesa_test.rb', line 951 def shell @shell end |
#test_name ⇒ Object (readonly)
Returns the value of attribute test_name.
951 952 953 |
# File 'lib/mesa_test.rb', line 951 def test_name @test_name end |
Class Method Details
.modules ⇒ Object
953 954 955 |
# File 'lib/mesa_test.rb', line 953 def self.modules %i[star binary astero] end |
Instance Method Details
#do_one ⇒ Object
just punt to each_test_run in the test_suite directory. It’s your problem now, sucker!
990 991 992 993 994 995 |
# File 'lib/mesa_test.rb', line 990 def do_one shell.say("Testing #{test_name}", :yellow) visit_dir(test_suite_dir) do bash_execute("./each_test_run #{position}") end end |
#err_64 ⇒ Object
Base-64 encoded contents of err.txt file
1025 1026 1027 1028 1029 1030 |
# File 'lib/mesa_test.rb', line 1025 def err_64 err_file = File.join(test_case_dir, 'err.txt') return '' unless File.exist?(err_file) b64_file(err_file) end |
#mk_64 ⇒ Object
Base-64 encoded contents of mk.txt file
1017 1018 1019 1020 1021 1022 |
# File 'lib/mesa_test.rb', line 1017 def mk_64 mk_file = File.join(test_case_dir, 'mk.txt') return '' unless File.exist?(mk_file) b64_file(mk_file) end |
#out_64 ⇒ Object
Base-64 encoded contents of out.txt file
1033 1034 1035 1036 1037 1038 |
# File 'lib/mesa_test.rb', line 1033 def out_64 out_file = File.join(test_case_dir, 'out.txt') return '' unless File.exist?(out_file) b64_file(out_file) end |
#passed? ⇒ Boolean
whether or not a test case has passed; only has meaning if we can load the results hash, though
1012 1013 1014 |
# File 'lib/mesa_test.rb', line 1012 def passed? results_hash['outcome'] == :pass end |
#ran? ⇒ Boolean
rough proxy for whether or not the test has even been run
1006 1007 1008 |
# File 'lib/mesa_test.rb', line 1006 def ran? File.exist?(testhub_file) end |
#results_hash ⇒ Object
997 998 999 1000 1001 1002 1003 |
# File 'lib/mesa_test.rb', line 997 def results_hash unless ran? raise TestCaseDirError.new('No results found for test case '\ "#{test_name}.") end YAML.load(File.read(testhub_file)) end |
#test_case_dir ⇒ Object
980 981 982 |
# File 'lib/mesa_test.rb', line 980 def test_case_dir File.join(test_suite_dir, test_name) end |
#test_suite_dir ⇒ Object
976 977 978 |
# File 'lib/mesa_test.rb', line 976 def test_suite_dir mesa.test_suite_dir(mod: @mod) end |
#testhub_file ⇒ Object
984 985 986 |
# File 'lib/mesa_test.rb', line 984 def testhub_file File.join(test_case_dir, 'testhub.yml') end |