Class | Test::Unit::Assertions::AssertionMessage
In: | test/unit/assertions.rb
Parent: | Object

### Methods

add_period convert literal new template to_s

### Included Modules

Util::BacktraceFilter

### Classes and Modules

Class Test::Unit::Assertions::AssertionMessage::Literal
Class Test::Unit::Assertions::AssertionMessage::Template

### Attributes

use_pp | [RW] |

### Public Class methods

literal(value)

[Source]

    # File test/unit/assertions.rb, line 420
            def self.literal(value)
              Literal.new(value)
            end

new(head, template_string, parameters)

[Source]

    # File test/unit/assertions.rb, line 426
            def initialize(head, template_string, parameters)
              @head = head
              @template_string = template_string
              @parameters = parameters
            end

### Public Instance methods

add_period(string)

[Source]

    # File test/unit/assertions.rb, line 462
            def add_period(string)
              (string =~ /\.\Z/ ? string : string + '.')
            end

convert(object)

[Source]

    # File test/unit/assertions.rb, line 432
            def convert(object)
              case object
                when Exception
                  "Class: <\#{convert(object.class)}>\nMessage: <\#{convert(object.message)}>\n---Backtrace---\n\#{filter_backtrace(object.backtrace).join(\"\\n\")}\n---------------\n".chop
                else
                  if(self.class.use_pp)
                    begin
                      require 'pp'
                    rescue LoadError
                      self.class.use_pp = false
                      return object.inspect
                    end unless(defined?(PP))
                    PP.pp(object, '').chomp
                  else
                    object.inspect
                  end
              end
            end

template()

[Source]

    # File test/unit/assertions.rb, line 458
            def template
              @template ||= Template.create(@template_string)
            end

to_s()

[Source]

    # File test/unit/assertions.rb, line 466
            def to_s
              message_parts = []
              if (@head)
                head = @head.to_s
                unless(head.empty?)
                  message_parts << add_period(head)
                end
              end
              tail = template.result(@parameters.collect{|e| convert(e)})
              message_parts << tail unless(tail.empty?)
              message_parts.join("\n")
            end

[Validate]