Created
August 19, 2009 16:50
-
-
Save mlooney/170456 to your computer and use it in GitHub Desktop.
An evil hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
class Funky | |
def self.datehack(a=1, b=a+1) | |
b | |
end | |
def self.evildatehack(a=b+1, b=1) | |
a | |
end | |
end | |
class ArgHack < Test::Unit::TestCase | |
def test_date_hack | |
assert_equal 2, Funky.datehack | |
assert_equal 4, Funky.datehack(3) | |
end | |
def test_evildate_hack | |
assert_raise NameError do | |
assert_equal 2, Funky.evildatehack | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment