summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-03-13 12:48:06 -0700
committerDylan Baker <dylan@pnwbakers.com>2024-03-15 09:15:48 -0700
commitb1340e9bb1f243e4de8f2d89415a45ade476a3dc (patch)
treecc12133a8c23d2945705814409a67ec157878d01 /test cases
parent6d713e40f81512eadb0cc4654408d90cb22ba774 (diff)
downloadmeson-b1340e9bb1f243e4de8f2d89415a45ade476a3dc.tar.gz
interpreter: when overriding a dependency make its name match
Otherwise internal dependencies have auto-generated names that are not human readable. Instead, use the name that the dependency overrides. For example: ```meson meson.override_dependency('zlib', declare_dependency()) dep_zlib = dependency('zlib') assert(dep_zlib.name() == 'zlib') ``` Fixes: #12967
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/98 subproject subdir/meson.build18
1 files changed, 17 insertions, 1 deletions
diff --git a/test cases/common/98 subproject subdir/meson.build b/test cases/common/98 subproject subdir/meson.build
index ef053d86c..d2bafedf5 100644
--- a/test cases/common/98 subproject subdir/meson.build
+++ b/test cases/common/98 subproject subdir/meson.build
@@ -1,3 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2016-2023 The Meson Developers
+# Copyright © 2024 Intel Corporation
+
project('proj', 'c')
subproject('sub')
libSub = dependency('sub', fallback: ['sub', 'libSub'])
@@ -6,7 +10,19 @@ exe = executable('prog', 'prog.c', dependencies: libSub)
test('subproject subdir', exe)
# Verify the subproject has placed dependency override.
-dependency('sub-1.0')
+d = dependency('sub-1.0')
+
+# verify that the name is the overridden name
+assert(d.name() == 'sub-1.0', 'name was not properly set, should have been "sub-1.0", but was @0@'.format(d.name()))
+
+# Verify that when a dependency object is used for two overrides, the correct
+# name is used
+meson.override_dependency('new-dep', d)
+d2 = dependency('new-dep')
+assert(d2.name() == 'new-dep', 'name was not properly set, should have been "new-dep", but was @0@'.format(d2.name()))
+
+# And that the old dependency wasn't changed
+assert(d.name() == 'sub-1.0', 'original dependency was mutated.')
# Verify we can now take 'sub' dependency without fallback, but only version 1.0.
dependency('sub')