diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-02-11 16:34:37 +0000 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-09-15 15:39:02 +0100 |
commit | 963107b737daf28ec7e26856bb977bd92ab00033 (patch) | |
tree | ac853f8bb4bd526d6c38642c25205e7fc0ab2abc | |
parent | 3f51745b414d027785666aa6790aff1bdb36b3c8 (diff) | |
download | meson-963107b737daf28ec7e26856bb977bd92ab00033.tar.gz |
Add a test for 'meson introspect --targets|--target-files'
v2:
Use asssertCountEqual for list comparison ignoring order
-rwxr-xr-x | run_unittests.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 96802cc8c..58ab3e1f0 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2372,6 +2372,38 @@ int main(int argc, char **argv) { self.init(testdir, ['--cross-file=' + name], inprocess=True) self.wipe() + def test_introspect_target_files(self): + ''' + Tests that mesonintrospect --target-files returns expected output. + ''' + testdir = os.path.join(self.common_test_dir, '8 install') + self.init(testdir) + expected = { + 'stat@sta': ['stat.c'], + 'prog@exe': ['prog.c'], + } + t_intro = self.introspect('--targets') + self.assertCountEqual([t['id'] for t in t_intro], expected) + for t in t_intro: + id = t['id'] + tf_intro = self.introspect(['--target-files', id]) + self.assertEqual(tf_intro, expected[id]) + self.wipe() + + testdir = os.path.join(self.common_test_dir, '53 custom target') + self.init(testdir) + expected = { + 'bindat@cus': ['data_source.txt'], + 'depfile@cus': [], + } + t_intro = self.introspect('--targets') + self.assertCountEqual([t['id'] for t in t_intro], expected) + for t in t_intro: + id = t['id'] + tf_intro = self.introspect(['--target-files', id]) + self.assertEqual(tf_intro, expected[id]) + self.wipe() + def test_compiler_run_command(self): ''' The test checks that the compiler object can be passed to |