From 98eb7a48ab3de0122e8c5e8a188527d71a23a914 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Tue, 27 Nov 2018 22:27:34 +0100 Subject: [PATCH] Added unit test --- mesonbuild/mintro.py | 2 +- run_unittests.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 4f0e9288f..d37211235 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -663,4 +663,4 @@ def generate_introspection_file(coredata, builddata, testdata, benchmarkdata, in outfile = os.path.abspath(outfile) with open(outfile, 'w') as fp: - json.dump(outdict, fp, indent=2) + json.dump(outdict, fp) diff --git a/run_unittests.py b/run_unittests.py index 9259b03c8..9088a868e 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3110,6 +3110,36 @@ recommended as it is not supported on some platforms''') self.maxDiff = None self.assertListEqual(res_nb, res_wb) + def test_introspect_all_command(self): + testdir = os.path.join(self.common_test_dir, '6 linkshared') + self.init(testdir) + res = self.introspect('--all') + keylist = [ + 'benchmarks', + 'buildoptions', + 'buildsystem_files', + 'dependencies', + 'installed', + 'projectinfo', + 'targets', + 'tests' + ] + + for i in keylist: + self.assertIn(i, res) + + def test_introspect_file_dump_eauals_all(self): + testdir = os.path.join(self.common_test_dir, '6 linkshared') + self.init(testdir) + res_all = self.introspect('--all') + res_file = {} + + introfile = os.path.join(self.builddir, 'meson-introspection.json') + self.assertPathExists(introfile) + with open(introfile, 'r') as fp: + res_file = json.load(fp) + + self.assertEqual(res_all, res_file) class FailureTests(BasePlatformTests): '''