Merge pull request #54 from bsodmike/master
Others may find these tweaks useful...
This commit is contained in:
@@ -59,12 +59,20 @@ class AboutControlStatements < EdgeCase::Koan
|
||||
|
||||
def test_unless_statement
|
||||
result = :default_value
|
||||
unless false
|
||||
unless false # same as saying 'if !false', which evaluates as 'if true'
|
||||
result = :false_value
|
||||
end
|
||||
assert_equal __, result
|
||||
end
|
||||
|
||||
def test_unless_statement_evaluate_true
|
||||
result = :default_value
|
||||
unless true # same as saying 'if !true', which evaluates as 'if false'
|
||||
result = :true_value
|
||||
end
|
||||
assert_equal __, result
|
||||
end
|
||||
|
||||
def test_unless_statement_modifier
|
||||
result = :default_value
|
||||
result = :false_value unless false
|
||||
|
||||
@@ -62,6 +62,7 @@ class AboutMethods < EdgeCase::Koan
|
||||
end
|
||||
|
||||
def test_calling_with_variable_arguments
|
||||
assert_equal __, method_with_var_args.class
|
||||
assert_equal __, method_with_var_args
|
||||
assert_equal __, method_with_var_args(:one)
|
||||
assert_equal __, method_with_var_args(:one, :two)
|
||||
|
||||
@@ -84,6 +84,8 @@ class AboutRegularExpressions < EdgeCase::Koan
|
||||
def test_shortcut_character_classes_are_negated_with_capitals
|
||||
assert_equal __, "the number is 42"[/\D+/]
|
||||
assert_equal __, "space: \t\n"[/\S+/]
|
||||
# ... a programmer would most likely do
|
||||
assert_equal __, "variable_1 = 42"[/[^a-zA-Z0-9_]+/]
|
||||
assert_equal __, "variable_1 = 42"[/\W+/]
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user