[meld] test_filediff: Add expected text test to filter text testcase
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] test_filediff: Add expected text test to filter text testcase
- Date: Sat, 2 Jul 2016 00:37:13 +0000 (UTC)
commit 760f63acaf2f538fa1aa3ba68ddf1819fc86e9cd
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jul 2 10:20:08 2016 +1000
test_filediff: Add expected text test to filter text testcase
test/test_filediff.py | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/test/test_filediff.py b/test/test_filediff.py
index d3f8aca..86b9759 100644
--- a/test/test_filediff.py
+++ b/test/test_filediff.py
@@ -8,61 +8,71 @@ from meld.filediff import FileDiff
from meld.filters import FilterEntry
- pytest mark parametrize("text, ignored_ranges", [
+ pytest mark parametrize("text, ignored_ranges, expected_text", [
# 0123456789012345678901234567890123456789012345678901234567890123456789
# Matching without groups
(
"# asdasdasdasdsad",
[(0, 17)],
+ "",
),
# Matching with single group
(
"asdasdasdasdsab",
[(1, 14)],
+ "ab",
),
# Matching with multiple groups
(
"xasdyasdz",
[(1, 4), (5, 8)],
+ "xyz",
),
# Matching with multiple partially overlapping filters
(
"qaqxqbyqzq",
[(2, 6), (7, 8)],
+ "qayzq",
),
# Matching with multiple fully overlapping filters
(
"qaqxqybqzq",
[(2, 8)],
+ "qazq",
),
# Matching with and without groups, with single dominated match
(
"# asdasdasdasdsab",
[(0, 17)],
+ "",
),
# Matching with and without groups, with partially overlapping filters
(
"/*a*/ub",
[(0, 6)],
+ "b",
),
# Non-matching with groups
(
"xasdyasdx",
[],
+ "xasdyasdx",
),
# Multiple lines with non-overlapping filters
(
"#ab\na2b",
[(0, 3), (5, 6)],
+ "\nab",
),
# CVS keyword
(
"$Author: John Doe $",
[(8, 18)],
+ "$Author:$",
),
])
-def test_filter_text(text, ignored_ranges):
+def test_filter_text(text, ignored_ranges, expected_text):
filter_patterns = [
'#.*',
'/\*.*\*/',
@@ -102,3 +112,4 @@ def test_filter_text(text, ignored_ranges):
print("Toggles:", toggles)
assert toggles == ignored_ranges
+ assert text == expected_text
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]