[diffoscope] 04/05: tests: Test --text-color output format.

Chris Lamb chris at chris-lamb.co.uk
Sun Jan 22 07:31:30 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 625783649bd7ef16aaa76dd2a35a9d973476af9b
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Jan 22 19:23:55 2017 +1300

    tests: Test --text-color output format.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 tests/data/output.colored.txt | 31 +++++++++++++++++++++++++++++++
 tests/test_presenters.py      |  5 +++++
 2 files changed, 36 insertions(+)

diff --git a/tests/data/output.colored.txt b/tests/data/output.colored.txt
new file mode 100644
index 0000000..62102c0
--- /dev/null
+++ b/tests/data/output.colored.txt
@@ -0,0 +1,31 @@
+--- test1.tar
++++ test2.tar
+├── file list
+│ @@ -1,4 +1,4 @@
+│ -drwxr-xr-x   0 lunar     (1000) lunar     (1000)        0 2015-06-29 15:49:09.000000 dir/
+│ --rw-r--r--   0 lunar     (1000) lunar     (1000)      446 2015-06-29 15:49:09.000000 dir/text
+│ -crw-r--r--   0 root         (0) root         (0)    1,  3 2015-06-29 15:49:09.000000 dir/null
+│ -lrwxrwxrwx   0 lunar     (1000) lunar     (1000)        0 2015-06-29 15:49:09.000000 dir/link -> broken
+│ +drwxr-xr-x   0 lunar     (1000) lunar     (1000)        0 2015-06-29 15:49:41.000000 dir/
+│ +-rw-r--r--   0 lunar     (1000) lunar     (1000)      671 2015-06-29 15:49:41.000000 dir/text
+│ +crw-r--r--   0 root         (0) root         (0)    1,  3 2015-06-29 15:49:41.000000 dir/null
+│ +lrwxrwxrwx   0 lunar     (1000) lunar     (1000)        0 2015-06-29 15:49:41.000000 dir/link -> really-broken
+├── dir/text
+│ @@ -1,6 +1,12 @@
+│ +A common form of lorem ipsum reads:
+│ +
+│  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+│  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+│  nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+│  Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+│  fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+│  culpa qui officia deserunt mollit anim id est laborum.
+│ +
+│ +"Lorem ipsum" text is derived from sections 1.10.32--3 of Cicero's De finibus
+│ +bonorum et malorum (On the Ends of Goods and Evils, or alternatively [About]
+│ +The Purposes of Good and Evil).
+├── dir/link
+│┄ symlink
+│ @@ -1 +1 @@
+│ -destination: broken
+│ +destination: really-broken
diff --git a/tests/test_presenters.py b/tests/test_presenters.py
index 888f614..b068b65 100644
--- a/tests/test_presenters.py
+++ b/tests/test_presenters.py
@@ -61,6 +61,11 @@ def extract_body(val):
 
     return result
 
+def test_text_option_color(capsys):
+    out = run(capsys, '--text-color=always')
+
+    assert out == data('output.colored.txt')
+
 def test_text_option_with_file(tmpdir, capsys):
     report_path = str(tmpdir.join('report.txt'))
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list