Class: Test::Unit::Omission

Inherits:
Object
  • Object
show all
Includes:
Util::BacktraceFilter
Defined in:
lib/test/unit/omission.rb

Constant Summary collapse

SINGLE_CHARACTER =
'O'
LABEL =
"Omission"

Constants included from Util::BacktraceFilter

Util::BacktraceFilter::TESTUNIT_FILE_SEPARATORS, Util::BacktraceFilter::TESTUNIT_PREFIX, Util::BacktraceFilter::TESTUNIT_RB_FILE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::BacktraceFilter

filter_backtrace

Constructor Details

#initialize(test_name, location, message) ⇒ Omission

Creates a new Omission with the given location and message.



14
15
16
17
18
# File 'lib/test/unit/omission.rb', line 14

def initialize(test_name, location, message)
  @test_name = test_name
  @location = location
  @message = message
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/test/unit/omission.rb', line 7

def location
  @location
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/test/unit/omission.rb', line 7

def message
  @message
end

#test_nameObject (readonly)

Returns the value of attribute test_name.



7
8
9
# File 'lib/test/unit/omission.rb', line 7

def test_name
  @test_name
end

Instance Method Details

#critical?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/test/unit/omission.rb', line 45

def critical?
  true
end

#labelObject



25
26
27
# File 'lib/test/unit/omission.rb', line 25

def label
  LABEL
end

#long_displayObject

Returns a verbose version of the error description.



35
36
37
38
# File 'lib/test/unit/omission.rb', line 35

def long_display
  backtrace = filter_backtrace(location).join("\n")
  "#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
end

#short_displayObject

Returns a brief version of the error description.



30
31
32
# File 'lib/test/unit/omission.rb', line 30

def short_display
  "#{@test_name}: #{@message.split("\n")[0]}"
end

#single_character_displayObject

Returns a single character representation of a omission.



21
22
23
# File 'lib/test/unit/omission.rb', line 21

def single_character_display
  SINGLE_CHARACTER
end

#to_sObject

Overridden to return long_display.



41
42
43
# File 'lib/test/unit/omission.rb', line 41

def to_s
  long_display
end