From a52c3e8e12ef6bc0fc7066a852e60857bb7da8ca Mon Sep 17 00:00:00 2001 From: Frank Scherrer Date: Tue, 4 Sep 2018 09:24:12 +0200 Subject: [PATCH] add further tests for which * test which for always present binary "ls" * test which for garbage input --- tests/test_util.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_util.py b/tests/test_util.py index 64c320f..1aaeaef 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -55,11 +55,19 @@ class TestUtil(unittest.TestCase): execute(self.some_command_with_args) def test_which(self): + # test for a binary that has to be somewhere + print(which("ls")) + self.assertTrue(re.search('/(ls)$', which("ls"))) + + # test for a binary that is not necessarily there program = "iwgetid" self.assertTrue( which(program) is None or re.search('/(' + program + ')$', which(program)) ) + # test if which also works with garbage input + self.assertTrue(which("qwertygarbage") is None) + # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4