From 4b428053f496720ec437eb5d455c86ada2de7977 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 2 Jun 2017 10:34:19 +0530 Subject: ninja: Use shlex.quote for quoting on non-Windows This is more reliable, and more accurate. For instance, this means arguments in commands aren't surrounded by `'` on Linux unless that is actually needed by that specific argument. There is no equivalent helper for Windows, so we keep the old behaviour for that. --- run_unittests.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'run_unittests.py') diff --git a/run_unittests.py b/run_unittests.py index 71448f9..a610e6b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1266,15 +1266,15 @@ class LinuxlikeTests(BasePlatformTests): self.assertIsNotNone(vala_command) self.assertIsNotNone(c_command) # -w suppresses all warnings, should be there in Vala but not in C - self.assertIn("'-w'", vala_command) - self.assertNotIn("'-w'", c_command) + self.assertIn(" -w ", vala_command) + self.assertNotIn(" -w ", c_command) # -Wall enables all warnings, should be there in C but not in Vala - self.assertNotIn("'-Wall'", vala_command) - self.assertIn("'-Wall'", c_command) + self.assertNotIn(" -Wall ", vala_command) + self.assertIn(" -Wall ", c_command) # -Werror converts warnings to errors, should always be there since it's # injected by an unrelated piece of code and the project has werror=true - self.assertIn("'-Werror'", vala_command) - self.assertIn("'-Werror'", c_command) + self.assertIn(" -Werror ", vala_command) + self.assertIn(" -Werror ", c_command) def test_qt5dependency_pkgconfig_detection(self): ''' @@ -1405,7 +1405,7 @@ class LinuxlikeTests(BasePlatformTests): self.init(testdir, ['-D' + std_opt]) cmd = self.get_compdb()[0]['command'] if v != 'none': - cmd_std = "'-std={}'".format(v) + cmd_std = " -std={} ".format(v) self.assertIn(cmd_std, cmd) try: self.build() @@ -1420,7 +1420,7 @@ class LinuxlikeTests(BasePlatformTests): os.environ[env_flags] = cmd_std self.init(testdir) cmd = self.get_compdb()[0]['command'] - qcmd_std = "'{}'".format(cmd_std) + qcmd_std = " {} ".format(cmd_std) self.assertIn(qcmd_std, cmd) with self.assertRaises(subprocess.CalledProcessError, msg='{} should have failed'.format(qcmd_std)): -- cgit v1.1