Class: TLDR::TestResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/tldr/value/test_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ TestResult

Returns a new instance of TestResult.



5
6
7
8
9
# File 'lib/tldr/value/test_result.rb', line 5

def initialize(*args)
  super
  @type = determine_type
  @error_location = determine_error_location
end

Instance Attribute Details

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



2
3
4
# File 'lib/tldr/value/test_result.rb', line 2

def error
  @error
end

#error_locationObject (readonly)

Returns the value of attribute error_location.



3
4
5
# File 'lib/tldr/value/test_result.rb', line 3

def error_location
  @error_location
end

#runtimeObject

Returns the value of attribute runtime

Returns:

  • (Object)

    the current value of runtime



2
3
4
# File 'lib/tldr/value/test_result.rb', line 2

def runtime
  @runtime
end

#testObject

Returns the value of attribute test

Returns:

  • (Object)

    the current value of test



2
3
4
# File 'lib/tldr/value/test_result.rb', line 2

def test
  @test
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/tldr/value/test_result.rb', line 3

def type
  @type
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/tldr/value/test_result.rb', line 31

def error?
  type == :error
end

#failing?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/tldr/value/test_result.rb', line 15

def failing?
  !passing?
end

#failure?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/tldr/value/test_result.rb', line 27

def failure?
  type == :failure
end

#passing?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/tldr/value/test_result.rb', line 11

def passing?
  success? || skip?
end

#relevant_locationObject



35
36
37
# File 'lib/tldr/value/test_result.rb', line 35

def relevant_location
  error_location || test.location
end

#skip?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/tldr/value/test_result.rb', line 23

def skip?
  type == :skip
end

#success?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/tldr/value/test_result.rb', line 19

def success?
  type == :success
end