Commit 9924a636 by Gabriel Falcao

small refactoring on tests

parent aea3661b
...@@ -37,7 +37,7 @@ def test_step_definition(): ...@@ -37,7 +37,7 @@ def test_step_definition():
definition = core.StepDefinition("FOO BAR", dumb) definition = core.StepDefinition("FOO BAR", dumb)
assert_equals(definition.function, dumb) assert_equals(definition.function, dumb)
assert_equals(definition.file, core.fs.relpath(__file__).rstrip("c")) assert_equals(definition.file, core.fs.relpath(__file__).rstrip("c"))
assert_equals(definition.line, 34) assert_equals(definition.line, 35)
def test_step_description(): def test_step_description():
......
...@@ -317,7 +317,7 @@ def test_parse_hashes_allow_empty(): ...@@ -317,7 +317,7 @@ def test_parse_hashes_allow_empty():
def test_identifies_tag_lines(): def test_identifies_tag_lines():
"strings.extract_tags_from_line simple case" "strings.extract_tags_from_line not matching anything"
# No tags tests # No tags tests
tags = strings.extract_tags_from_line("") tags = strings.extract_tags_from_line("")
assert_equals(tags, None) assert_equals(tags, None)
...@@ -327,9 +327,14 @@ def test_identifies_tag_lines(): ...@@ -327,9 +327,14 @@ def test_identifies_tag_lines():
assert_equals(tags, None) assert_equals(tags, None)
tags = strings.extract_tags_from_line(" | example step hash | line |") tags = strings.extract_tags_from_line(" | example step hash | line |")
assert_equals(tags, None) assert_equals(tags, None)
tags = strings.extract_tags_from_line(" | example step hash | line @with | @tag like |") tags = strings.extract_tags_from_line(
" | example step hash | line @with | @tag like |")
assert_equals(tags, None) assert_equals(tags, None)
# Now for positive tests
def test_finding_tags():
"strings.extract_tags_from_line matching simple cases"
tags = strings.extract_tags_from_line("@one") tags = strings.extract_tags_from_line("@one")
assert_equals(tags, ["one"]) assert_equals(tags, ["one"])
tags = strings.extract_tags_from_line(" @one ") tags = strings.extract_tags_from_line(" @one ")
...@@ -340,11 +345,15 @@ def test_identifies_tag_lines(): ...@@ -340,11 +345,15 @@ def test_identifies_tag_lines():
assert_equals(tags, ["one", "two", "three"]) assert_equals(tags, ["one", "two", "three"])
tags = strings.extract_tags_from_line(" @one.two @three_four ") tags = strings.extract_tags_from_line(" @one.two @three_four ")
assert_equals(tags, ["one.two", "three_four"]) assert_equals(tags, ["one.two", "three_four"])
# Odd tests
def test_dont_find_tags_in_weird_cases():
"don't find tags in weird cases"
tags = strings.extract_tags_from_line(" @one two @three @four ") tags = strings.extract_tags_from_line(" @one two @three @four ")
assert_equals(tags, None) assert_equals(tags, None)
def test_consume_tag_lines(): def test_consume_tag_lines():
"strings.consume_tags_lines simple case" "strings.consume_tags_lines simple case"
# No tags # No tags
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment