Skip to content
Snippets Groups Projects
Commit cb42460a authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Add a test for recent file(1) issue regarding .changes files. (Re:...

Add a test for recent file(1) issue regarding .changes files. (Re: #291)
parent b5d46b42
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.missing_file import MissingFile
from diffoscope.comparators.utils.specialize import specialize
from ..utils.data import data, get_data
from ..utils.data import data, get_data, load_fixture
from ..utils.tools import skip_unless_module_exists
from ..utils.nonexisting import assert_non_existing
......@@ -53,6 +53,8 @@ TEST_DOT_BUILDINFO_FILE2 = data("test2.buildinfo")
TEST_DEB_FILE1 = data("test1.deb")
TEST_DEB_FILE2 = data("test2.deb")
changes5 = load_fixture("test5.changes")
@pytest.fixture
def dot_changes1(tmpdir):
......@@ -351,3 +353,13 @@ def test_fallback_comparisons(monkeypatch):
assert file1.compare(file1) is None
assert file2.compare(file2) is None
assert file1.compare(file2).unified_diff == get_data(expected_diff)
def test_unicode_identification(changes5):
# .changes can be identified by file(1) as:
#
# * "ASCII text"
# * "UTF-8 Unicode text" (older versions of file)
# * "Unicode text, UTF-8 text"
# * "data" (files with broken Unicode: reproducible-builds/diffoscope#286)
assert isinstance(changes5, DotChangesFile)
Format: 1.8
Date: Sat, 04 Apr 2015 18:30:48 +0200
Source: test
Binary: test
Architecture: source all
Version: 1
Distribution: unstable
Urgency: low
Maintainer: Someone Else 𝐀 𝐁 𝐂 <user@example.org>
Changed-By: Someone Else 𝐀 𝐁 𝐂 <user@example.org>
Description:
test - just a simple test package
Changes:
test (1) unstable; urgency=low
.
* Test package.
* Unicode test: 𝐀 𝐁 𝐂 𝐃 𝐄 𝐅 𝐆 𝐇 𝐈 𝐉 𝐊 𝐋 𝐌 𝐍 𝐎 𝐏 𝐐 𝐑 𝐒 𝐓 𝐔 𝐕 𝐖 𝐗 𝐘 𝐙.
Checksums-Sha1:
70982664db2015334bff6441b429d7e3c58dbecb 2388 test_1_all.deb
91d2cc6aadddb4a24b0c2f8f24d558ce0e07f9cd 3765 test_2.buildinfo
Checksums-Sha256:
2f2e45ee3a5fdacd9b30133ec728121588bf9b97af3b947b3882b2b28a0555da 2388 test_1_all.deb
917d8b5c3ade2bde26fe2b7476481537f32a0c07f10e5e44c0ca7a02c8bfa9d8 3765 test_2.buildinfo
Files:
d323c454462407fe3bfde31a74b23eba 2388 devel optional test_1_all.deb
9972d7c394228311ba92cbcbfe2d6cd9 3765 web optional test_2.buildinfo
......@@ -218,6 +218,7 @@ ALLOWED_TEST_FILES = {
"test4.changes",
"test4.gif",
"test4.pdf",
"test5.changes",
"test_comment1.zip",
"test_comment2.zip",
"test_invalid.json",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment