From d8b7080dcb56ab5fe927c22d08b6f1b0081ad8d9 Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Fri, 25 Nov 2022 16:50:29 +0100 Subject: [PATCH] Compare output of command help with unknown argument with corresponding output of man command The error message may be different depending on the man tool used. Therefore, instead of hard-coding it into the test, ensure it is the same as produced by the man command Closes #512 Signed-off-by: Thomas Lauf --- test/help.t | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/help.t b/test/help.t index 786def02..ae96d863 100755 --- a/test/help.t +++ b/test/help.t @@ -34,6 +34,7 @@ import unittest sys.path.append(os.path.dirname(os.path.abspath(__file__))) from basetest import Timew, TestCase +from basetest.utils import run_cmd_wait_nofail class TestHelp(TestCase): @@ -66,8 +67,10 @@ class TestHelp(TestCase): def test_help_with_unknown_argument_should_show_error_message(self): """timew help with unknown argument should show error message""" - code, out, err = self.t.runError("help bogus") - self.assertRegex(err, r"No manual entry for timew-bogus") + _, _, expected = run_cmd_wait_nofail(["man", "timew-bogus"]) + _, _, actual = self.t.runError("help bogus") + + self.assertEqual(actual, expected) def test_command_with_help_long_option_should_show_help_page(self): """timew command with --help should show help page"""