Skip to content

Commit

Permalink
Add test to improve code coverage.
Browse files Browse the repository at this point in the history
(cherry picked from commit 5703dbc)
  • Loading branch information
kevinbackhouse authored and mergify-bot committed Aug 27, 2021
1 parent f024ebe commit 579d448
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/data/coverage_xmp_doctype.exv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY xxe SYSTEM "file:///dev/random" >]>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
<foo>
</foo>
</x:xmpmeta>
<?xpacket end="w"?>
20 changes: 20 additions & 0 deletions tests/bugfixes/github/test_coverage_xmp_doctype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-

from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors

class coverage_xmp_doctype(metaclass=CaseMeta):
"""
Test added to improve code coverage in xmpsidecar.cpp after
Codecov complained about a lack of code coverage in this PR:
https://github.com/Exiv2/exiv2/pull/1878
"""

filename = path("$data_path/coverage_xmp_doctype.exv")
commands = ["$exiv2 $filename"]
stderr = ["""Error: XMP Toolkit error 201: Error in XMLValidator
Warning: Failed to decode XMP metadata.
$filename: No Exif data found in the file
"""]
retval = [253]

compare_stdout = check_no_ASAN_UBSAN_errors

0 comments on commit 579d448

Please sign in to comment.