tests: Add a rewriter test that handles prefix

"prefix" has a lot of special handling that has to go on because so many
other options depend on prefix. It was also regressed by the option
refactor changes, so having a test feels appropriate.

This was verified against the 1.7 release, so it has the same behavior
as pre-option refactor Meson.
This commit is contained in:
Dylan Baker 2025-04-02 09:19:41 -07:00
parent 768712cf32
commit 9d1837e1af
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,5 @@
project('lalala', 'cpp',
default_options : [
'prefix=/export/doocs',
],
)

View File

@ -407,3 +407,18 @@ class RewriterTests(BasePlatformTests):
# Do it line per line because it is easier to debug like that
for orig_line, new_line in zip_longest(original_contents.splitlines(), new_contents.splitlines()):
self.assertEqual(orig_line, new_line)
@unittest.expectedFailure
def test_rewrite_prefix(self) -> None:
self.prime('7 prefix')
out = self.rewrite_raw(self.builddir, ['kwargs', 'info', 'project', '/'])
expected = {
'kwargs': {
'project#/': {
"default_options": [
'prefix=/export/doocs'
]
}
}
}
self.assertDictEqual(out, expected)