Skip to content

Commit

Permalink
working...
Browse files Browse the repository at this point in the history
  • Loading branch information
Danish Khan committed Mar 16, 2011
1 parent 63e82ae commit c4a2839
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions koans/about_regular_expressions.rb
Expand Up @@ -69,22 +69,22 @@ def test_slash_s_is_a_shortcut_for_a_whitespace_character_class

def test_slash_w_is_a_shortcut_for_a_word_character_class
# NOTE: This is more like how a programmer might define a word.
assert_equal __, "variable_1 = 42"[/[a-zA-Z0-9_]+/]
assert_equal __, "variable_1 = 42"[/\w+/]
assert_equal "variable_1", "variable_1 = 42"[/[a-zA-Z0-9_]+/]
assert_equal "variable_1", "variable_1 = 42"[/\w+/]
end

def test_period_is_a_shortcut_for_any_non_newline_character
assert_equal __, "abc\n123"[/a.+/]
assert_equal "abc", "abc\n123"[/a.+/]
end

def test_a_character_class_can_be_negated
assert_equal __, "the number is 42"[/[^0-9]+/]
assert_equal "the number is ", "the number is 42"[/[^0-9]+/]
end

def test_shortcut_character_classes_are_negated_with_capitals
assert_equal __, "the number is 42"[/\D+/]
assert_equal __, "space: \t\n"[/\S+/]
assert_equal __, "variable_1 = 42"[/\W+/]
assert_equal "the number is ", "the number is 42"[/\D+/]
assert_equal "space:", "space: \t\n"[/\S+/]
assert_equal " = ", "variable_1 = 42"[/\W+/]
end

# ------------------------------------------------------------------
Expand Down

0 comments on commit c4a2839

Please sign in to comment.