From f8af33c9f0ef38fbe9bd6944255738edc8d4e8c7 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Wed, 26 Oct 2022 16:32:42 +0000 Subject: update-manpages: explicitly strip color codes On some systems, help2man produces color codes in the output. Remove them to avoid manpage churn. Also begin adding unit tests. Change-Id: I3f0204b19d9cae524d3cb5fcfb61ee309b0931fc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/349655 Tested-by: LaMont Jones Reviewed-by: Xin Li --- tests/test_update_manpages.py | 27 +++++++++++++++++++++++++++ tests/update_manpages.py | 1 + 2 files changed, 28 insertions(+) create mode 100644 tests/test_update_manpages.py create mode 120000 tests/update_manpages.py (limited to 'tests') diff --git a/tests/test_update_manpages.py b/tests/test_update_manpages.py new file mode 100644 index 00000000..f0ef72af --- /dev/null +++ b/tests/test_update_manpages.py @@ -0,0 +1,27 @@ +# Copyright 2022 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unittests for the update_manpages module.""" + +import unittest +import tests.update_manpages as um + + +class UpdateManpagesTest(unittest.TestCase): + """Tests the update-manpages code.""" + + def test_replace_regex(self): + """Check that replace_regex works.""" + data = '\n\033[1mSummary\033[m\n' + self.assertEqual(um.replace_regex(data),'\nSummary\n') diff --git a/tests/update_manpages.py b/tests/update_manpages.py new file mode 120000 index 00000000..40bbdea7 --- /dev/null +++ b/tests/update_manpages.py @@ -0,0 +1 @@ +update-manpages \ No newline at end of file -- cgit v1.2.3-54-g00ecf