From efdfa5e130aeda6ec6562b6f2b346cb1933fa53f Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Thu, 9 Nov 2023 15:56:30 +0000 Subject: [PATCH] Test appdata files with 4-space indent Previously all the test cases, except for one really obnoxious one that uses inconsistent indentation, use a consistent 2-space indent. This ends up masking some bugs in the implementation that incorrectly use a 2-space indent in some cases. Happily it works fine in the common case where the element already exists with at least one within. --- tests/test_appdata.py | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tests/test_appdata.py b/tests/test_appdata.py index 4b93eb6f..b9a1ce11 100644 --- a/tests/test_appdata.py +++ b/tests/test_appdata.py @@ -55,6 +55,81 @@ def test_simple(self): """.strip(), ) + @unittest.expectedFailure + def test_four_space_no_releases_element(self): + # FIXME: This ends up indenting correctly, but + # and incorrectly get the default 2-space + # indent. + self._do_test( + """ + + + com.example.Workaround + My history is a mystery + + """.strip(), + """ + + + com.example.Workaround + My history is a mystery + + + + + + + """.strip(), + ) + + def test_four_space_one_prior_release(self): + self._do_test( + """ + + + + + + + """.strip(), + """ + + + + + + + + + + """.strip(), + ) + + def test_four_space_many_prior_releases(self): + self._do_test( + """ + + + + + + + + """.strip(), + """ + + + + + + + + + + + """.strip(), + ) + def test_mixed_indentation(self): """This input uses 3-space indentation for one existing and 4-space for another. Match the top one."""