Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (45 sloc) 1.218 kb
#!/usr/bin/env ruby
# -*- ruby -*-
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutAsserts < EdgeCase::Koan
# We shall contemplate truth by testing reality, via asserts.
def test_assert_truth
#--
assert true # This should be true
if false
#++
assert false # This should be true
#--
end
#++
end
# Enlightenment may be more easily achieved with appropriate
# messages.
def test_assert_with_message
#--
assert true, "This should be true -- Please fix this"
if false
#++
assert false, "This should be true -- Please fix this"
#--
end
#++
end
# To understand reality, we must compare our expectations against
# reality.
def test_assert_equality
expected_value = __(2)
actual_value = 1 + 1
assert expected_value == actual_value
end
# Some ways of asserting equality are better than others.
def test_a_better_way_of_asserting_equality
expected_value = __(2)
actual_value = 1 + 1
assert_equal expected_value, actual_value
end
# Sometimes we will ask you to fill in the values
def test_fill_in_values
assert_equal __(2), 1 + 1
end
end
Jump to Line
Something went wrong with that request. Please try again.