Class: MesaTestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/mesa_test.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test: nil, mesa: nil, mod: nil, position: nil) ⇒ MesaTestCase

Returns a new instance of MesaTestCase.



792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/mesa_test.rb', line 792

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

#mesaObject (readonly)

Returns the value of attribute mesa.



786
787
788
# File 'lib/mesa_test.rb', line 786

def mesa
  @mesa
end

#modObject (readonly)

Returns the value of attribute mod.



786
787
788
# File 'lib/mesa_test.rb', line 786

def mod
  @mod
end

#positionObject (readonly)

Returns the value of attribute position.



786
787
788
# File 'lib/mesa_test.rb', line 786

def position
  @position
end

#shellObject (readonly)

Returns the value of attribute shell.



786
787
788
# File 'lib/mesa_test.rb', line 786

def shell
  @shell
end

#test_nameObject (readonly)

Returns the value of attribute test_name.



786
787
788
# File 'lib/mesa_test.rb', line 786

def test_name
  @test_name
end

Class Method Details

.modulesObject



788
789
790
# File 'lib/mesa_test.rb', line 788

def self.modules
  %i[star binary astero]
end

Instance Method Details

#do_oneObject

just punt to each_test_run in the test_suite directory. It’s your problem now, sucker!



821
822
823
824
825
826
# File 'lib/mesa_test.rb', line 821

def do_one
  shell.say("Testing #{test_name}", :yellow)
  visit_dir(test_suite_dir) do
    bash_execute("./each_test_run #{position}")
  end
end

#results_hashObject



828
829
830
831
832
833
834
835
# File 'lib/mesa_test.rb', line 828

def results_hash
  testhub_file = File.join(test_case_dir, 'testhub.yml')
  unless File.exist?(testhub_file)
    raise TestCaseDirError.new('No results found for test case '\
                               "#{test_name}.")
  end
  YAML.safe_load(File.read(testhub_file), [Symbol])
end

#test_case_dirObject



815
816
817
# File 'lib/mesa_test.rb', line 815

def test_case_dir
  File.join(test_suite_dir, test_name)
end

#test_suite_dirObject



811
812
813
# File 'lib/mesa_test.rb', line 811

def test_suite_dir
  mesa.test_suite_dir(mod: @mod)
end