class Test::Unit::TestAssert

Public Instance Methods

test_error_invalid_message_true() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1505
def test_error_invalid_message_true
  check_fail("assertion message must be String, Proc or " +
              "Test::Unit::Assertions::AssertionMessage: " +
              "<true>(<TrueClass>)") do
    begin
      assert(true, true)
    rescue ArgumentError
      raise AssertionFailedError, $!.message
    end
  end
end
test_error_wrong_number_of_arguments() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1517
def test_error_wrong_number_of_arguments
  check_fail("wrong number of arguments (0 for 1..2)") do
    begin
      assert
    rescue ArgumentError
      raise AssertionFailedError, $!.message
    end
  end
end
test_fail_block() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1497
def test_fail_block
  check_fail(//) do
    assert do
      0.odd?
    end
  end
end
test_fail_false() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1475
def test_fail_false
  check_fail("<false> is not true.") do
    assert(false)
  end
end
test_fail_false_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1481
def test_fail_false_with_message
  check_fail("failed assert.\n" +
              "<false> is not true.") do
    assert(false, "failed assert")
  end
end
test_fail_nil() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1469
def test_fail_nil
  check_fail("<nil> is not true.") do
    assert(nil)
  end
end
test_fail_with_assertion_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1488
def test_fail_with_assertion_message
  check_fail("user message.\n" +
              "placeholder <:in> message") do
    assert(false, build_message("user message",
                                "placeholder <?> message",
                                :in))
  end
end
test_pass() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1443
def test_pass
  check_nothing_fails do
    assert(true)
  end
end
test_pass_block() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1461
def test_pass_block
  check_nothing_fails do
    assert do
      true
    end
  end
end
test_pass_neither_false_or_nil() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1449
def test_pass_neither_false_or_nil
  check_nothing_fails do
    assert("a")
  end
end
test_pass_with_message() click to toggle source
# File test-unit-3.3.4/test/test-assertions.rb, line 1455
def test_pass_with_message
  check_nothing_fails do
    assert(true, "successful assert")
  end
end