moar progress
This commit is contained in:
@@ -7,16 +7,16 @@ class AboutConstants < Neo::Koan
|
||||
C = "nested"
|
||||
|
||||
def test_nested_constants_may_also_be_referenced_with_relative_paths
|
||||
assert_equal __, C
|
||||
assert_equal "nested", C
|
||||
end
|
||||
|
||||
def test_top_level_constants_are_referenced_by_double_colons
|
||||
assert_equal __, ::C
|
||||
assert_equal "top level", ::C
|
||||
end
|
||||
|
||||
def test_nested_constants_are_referenced_by_their_complete_path
|
||||
assert_equal __, AboutConstants::C
|
||||
assert_equal __, ::AboutConstants::C
|
||||
assert_equal "nested", AboutConstants::C
|
||||
assert_equal "nested", ::AboutConstants::C
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
@@ -35,7 +35,7 @@ class AboutConstants < Neo::Koan
|
||||
end
|
||||
|
||||
def test_nested_classes_inherit_constants_from_enclosing_classes
|
||||
assert_equal __, Animal::NestedAnimal.new.legs_in_nested_animal
|
||||
assert_equal 4, Animal::NestedAnimal.new.legs_in_nested_animal
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
@@ -47,7 +47,7 @@ class AboutConstants < Neo::Koan
|
||||
end
|
||||
|
||||
def test_subclasses_inherit_constants_from_parent_classes
|
||||
assert_equal __, Reptile.new.legs_in_reptile
|
||||
assert_equal 4, Reptile.new.legs_in_reptile
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
@@ -63,7 +63,7 @@ class AboutConstants < Neo::Koan
|
||||
end
|
||||
|
||||
def test_who_wins_with_both_nested_and_inherited_constants
|
||||
assert_equal __, MyAnimals::Bird.new.legs_in_bird
|
||||
assert_equal 2, MyAnimals::Bird.new.legs_in_bird
|
||||
end
|
||||
|
||||
# QUESTION: Which has precedence: The constant in the lexical scope,
|
||||
@@ -78,7 +78,7 @@ class AboutConstants < Neo::Koan
|
||||
end
|
||||
|
||||
def test_who_wins_with_explicit_scoping_on_class_definition
|
||||
assert_equal __, MyAnimals::Oyster.new.legs_in_oyster
|
||||
assert_equal 4, MyAnimals::Oyster.new.legs_in_oyster
|
||||
end
|
||||
|
||||
# QUESTION: Now which has precedence: The constant in the lexical
|
||||
|
||||
Reference in New Issue
Block a user