Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
9c0a3d22
Commit
9c0a3d22
authored
8 years ago
by
Ximin Luo
Browse files
Options
Downloads
Patches
Plain Diff
presenters: text: fix recursive indentation of headers
parent
07297e67
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
diffoscope/presenters/text.py
+1
-1
1 addition, 1 deletion
diffoscope/presenters/text.py
tests/data/archive12.diff.txt
+15
-0
15 additions, 0 deletions
tests/data/archive12.diff.txt
tests/test_presenters.py
+8
-9
8 additions, 9 deletions
tests/test_presenters.py
with
24 additions
and
10 deletions
diffoscope/presenters/text.py
+
1
−
1
View file @
9c0a3d22
...
...
@@ -89,5 +89,5 @@ class TextPresenter(Presenter):
def
output
(
self
,
val
,
raw
=
False
):
self
.
print_func
(
self
.
indent
(
val
,
self
.
PREFIX
*
(
self
.
depth
+
0
if
raw
else
-
1
)),
self
.
indent
(
val
,
self
.
PREFIX
*
(
self
.
depth
+
(
0
if
raw
else
-
1
))
)
,
)
This diff is collapsed.
Click to expand it.
tests/data/archive12.diff.txt
0 → 100644
+
15
−
0
View file @
9c0a3d22
--- archive1.tar
+++ archive2.tar
├── file list
│ @@ -1 +1 @@
│ --rw-r--r-- 0 lamby (1000) lamby (1000) 22 2017-03-19 22:26:58.000000 compressed.gz
│ +-rw-r--r-- 0 lamby (1000) lamby (1000) 33 2017-03-19 22:27:42.000000 compressed.gz
├── compressed.gz
│ ├── metadata
│ │ @@ -1 +1 @@
│ │ -gzip compressed data, max compression, from Unix
│ │ +gzip compressed data, was "compressed", last modified: Sun Mar 19 22:27:42 2017, max compression, from Unix
│ ├── compressed
│ │ @@ -1 +1 @@
│ │ -a
│ │ +b
This diff is collapsed.
Click to expand it.
tests/test_presenters.py
+
8
−
9
View file @
9c0a3d22
...
...
@@ -29,9 +29,9 @@ from .utils.data import cwd_data, get_data
re_html
=
re
.
compile
(
r
'
.*<body(?P<body>.*)<div class=
"
footer
"
>
'
,
re
.
MULTILINE
|
re
.
DOTALL
)
def
run
(
capsys
,
*
args
):
def
run
(
capsys
,
*
args
,
pair
=
(
'
test1.tar
'
,
'
test2.tar
'
)
):
with
pytest
.
raises
(
SystemExit
)
as
exc
,
cwd_data
():
main
(
args
+
(
'
test1.tar
'
,
'
test2.tar
'
)
)
main
(
args
+
pair
)
out
,
err
=
capsys
.
readouterr
()
assert
err
==
''
...
...
@@ -39,13 +39,7 @@ def run(capsys, *args):
return
out
def
run_images
(
capsys
,
*
args
):
with
pytest
.
raises
(
SystemExit
)
as
exc
,
cwd_data
():
main
(
args
+
(
'
test1.png
'
,
'
test2.png
'
))
out
,
err
=
capsys
.
readouterr
()
assert
err
==
''
assert
exc
.
value
.
code
==
1
return
out
return
run
(
capsys
,
*
args
,
pair
=
(
'
test1.png
'
,
'
test2.png
'
))
def
extract_body
(
val
):
"""
...
...
@@ -65,6 +59,11 @@ def test_text_option_is_default(capsys):
assert
out
==
get_data
(
'
output.txt
'
)
def
test_text_proper_indentation
(
capsys
):
out
=
run
(
capsys
,
pair
=
(
'
archive1.tar
'
,
'
archive2.tar
'
))
assert
out
==
get_data
(
'
archive12.diff.txt
'
)
def
test_text_option_color
(
capsys
):
out
=
run
(
capsys
,
'
--text-color=always
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment