class RComp::Test

Attributes

err_result[RW]
expected_err_path[R]
expected_out_path[R]
formatted_path[R]
out_result[RW]
relative_path[R]
result[RW]
result_err_path[R]
result_out_path[R]
test_path[R]

Public Class Methods

new(path) click to toggle source

Initialize a new Test

path - The absolute path to the test

Stores relative path, paths to expected and result out/err and defaults result to :skipped

# File lib/rcomp/test.rb, line 18
def initialize(path)
  @result = :skipped
  @relative_path = rel_path(path)
  @test_path = path
  @result_out_path = get_path(:result, path, '.out')
  @result_err_path = get_path(:result, path, '.err')
  @expected_out_path = get_path(:expected, path, '.out')
  @expected_err_path = get_path(:expected, path, '.err')
  @formatted_path = format_path(@relative_path)
end

Public Instance Methods

expected_err_exists?() click to toggle source
# File lib/rcomp/test.rb, line 33
def expected_err_exists?
  @expected_err_exists ||= File.exists?(@expected_err_path)
end
expected_out_exists?() click to toggle source
# File lib/rcomp/test.rb, line 29
def expected_out_exists?
  @expected_out_exists ||= File.exists?(@expected_out_path)
end

Private Instance Methods

format_path(path) click to toggle source

Formats relative path for user output

path - A relative test path

Returns formatted path

# File lib/rcomp/test.rb, line 56
def format_path(path)
  path[1..-1]
end
get_path(type, test_path, extension) click to toggle source
# File lib/rcomp/test.rb, line 39
def get_path(type, test_path, extension)
  cmpnts = []
  if type == :result
    cmpnts << Conf.instance.result_root
  else
    cmpnts << Conf.instance.expected_root
  end
  cmpnts << rel_path(File.dirname(test_path))
  cmpnts << File.basename(test_path, ".*") + extension
  File.join(cmpnts)
end