diff options
| -rw-r--r-- | mesonbuild/cargo/manifest.py | 2 | ||||
| -rw-r--r-- | unittests/cargotests.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/cargo/manifest.py b/mesonbuild/cargo/manifest.py index 5e453c9a1..a194d0120 100644 --- a/mesonbuild/cargo/manifest.py +++ b/mesonbuild/cargo/manifest.py @@ -357,7 +357,7 @@ class Library(BuildTarget): path=DefaultValue('src/lib.rs'), edition=DefaultValue(pkg.edition), crate_type=ConvertValue(lambda x: ['proc-macro'] if proc_macro else x, - ['lib'])) + ['proc-macro'] if proc_macro else ['lib'])) @dataclasses.dataclass diff --git a/unittests/cargotests.py b/unittests/cargotests.py index 16bc4cfee..643ceceb4 100644 --- a/unittests/cargotests.py +++ b/unittests/cargotests.py @@ -499,6 +499,12 @@ class CargoTomlTest(unittest.TestCase): self.assertEqual(manifest.lib.crate_type, ['proc-macro']) self.assertEqual(manifest.lib.path, 'src/lib.rs') + del manifest_toml['lib']['crate-type'] + manifest = Manifest.from_raw(manifest_toml, 'Cargo.toml') + self.assertEqual(manifest.lib.name, 'bits') + self.assertEqual(manifest.lib.crate_type, ['proc-macro']) + self.assertEqual(manifest.lib.path, 'src/lib.rs') + def test_cargo_toml_targets(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: fname = os.path.join(tmpdir, 'Cargo.toml') |
