summaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-29 21:13:21 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-01-04 00:40:54 +0530
commit7f3aeb27e7e2e7f5f69234e78ea912830f7141ab (patch)
treec24bf73430c2d8debda22db6678a0f432526da2b /run_unittests.py
parent731aca216e2e840e114b5ab934e78bd3f8a59e5f (diff)
downloadmeson-7f3aeb27e7e2e7f5f69234e78ea912830f7141ab.tar.gz
unit tests: Use assertIn() instead of assertTrue()
assertIn() will print both the arguments on assertion fail, but assertTrue() will not, so that makes it easier to debug.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/run_unittests.py b/run_unittests.py
index c7a809555..d1c192f04 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -178,7 +178,7 @@ class LinuxlikeTests(unittest.TestCase):
testdir = os.path.join(self.common_test_dir, '3 static')
self.init(testdir)
compdb = self.get_compdb()
- self.assertTrue('-fPIC' in compdb[0]['command'])
+ self.assertIn('-fPIC', compdb[0]['command'])
# This is needed to increase the difference between build.ninja's
# timestamp and coredata.dat's timestamp due to a Ninja bug.
# https://github.com/ninja-build/ninja/issues/371
@@ -187,7 +187,7 @@ class LinuxlikeTests(unittest.TestCase):
# Regenerate build
self.build()
compdb = self.get_compdb()
- self.assertTrue('-fPIC' not in compdb[0]['command'])
+ self.assertNotIn('-fPIC', compdb[0]['command'])
def test_pkgconfig_gen(self):
'''
@@ -204,7 +204,7 @@ class LinuxlikeTests(unittest.TestCase):
simple_dep = PkgConfigDependency('libfoo', env, kwargs)
self.assertTrue(simple_dep.found())
self.assertEqual(simple_dep.get_version(), '1.0')
- self.assertTrue('-lfoo' in simple_dep.get_link_args())
+ self.assertIn('-lfoo', simple_dep.get_link_args())
def test_vala_c_warnings(self):
'''
@@ -229,15 +229,15 @@ class LinuxlikeTests(unittest.TestCase):
self.assertIsNotNone(vala_command)
self.assertIsNotNone(c_command)
# -w suppresses all warnings, should be there in Vala but not in C
- self.assertTrue("'-w'" in vala_command)
- self.assertFalse("'-w'" in 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.assertFalse("'-Wall'" in vala_command)
- self.assertTrue("'-Wall'" in 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.assertTrue("'-Werror'" in vala_command)
- self.assertTrue("'-Werror'" in c_command)
+ self.assertIn("'-Werror'", vala_command)
+ self.assertIn("'-Werror'", c_command)
def test_static_compile_order(self):
'''