aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-04-23 19:35:58 +0300
committerXavier Claessens <xclaesse@gmail.com>2023-11-02 07:55:32 -0400
commit204563751ed907cd507d3a1a2f48bd8c22b5bb97 (patch)
treeac97a62f96c8384d7896e6d3463fd74f991435ae /test cases
parent3500349df16908daed8788687af59a0521c074d4 (diff)
downloadmeson-204563751ed907cd507d3a1a2f48bd8c22b5bb97.zip
meson-204563751ed907cd507d3a1a2f48bd8c22b5bb97.tar.gz
meson-204563751ed907cd507d3a1a2f48bd8c22b5bb97.tar.bz2
rust: Add unit test for transitive rust dependencies
Diffstat (limited to 'test cases')
-rw-r--r--test cases/rust/20 transitive dependencies/liba/lib.rs3
-rw-r--r--test cases/rust/20 transitive dependencies/liba/meson.build5
-rw-r--r--test cases/rust/20 transitive dependencies/libb/lib.rs3
-rw-r--r--test cases/rust/20 transitive dependencies/libb/meson.build6
-rw-r--r--test cases/rust/20 transitive dependencies/main.rs3
-rw-r--r--test cases/rust/20 transitive dependencies/meson.build12
6 files changed, 32 insertions, 0 deletions
diff --git a/test cases/rust/20 transitive dependencies/liba/lib.rs b/test cases/rust/20 transitive dependencies/liba/lib.rs
new file mode 100644
index 0000000..0fc8ce5
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/liba/lib.rs
@@ -0,0 +1,3 @@
+pub fn foo() -> i32 {
+ 123
+}
diff --git a/test cases/rust/20 transitive dependencies/liba/meson.build b/test cases/rust/20 transitive dependencies/liba/meson.build
new file mode 100644
index 0000000..b32822d
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/liba/meson.build
@@ -0,0 +1,5 @@
+liba = static_library('liba', 'lib.rs',
+ rust_crate_type : 'rlib',
+)
+
+liba_dep = declare_dependency(link_with : liba)
diff --git a/test cases/rust/20 transitive dependencies/libb/lib.rs b/test cases/rust/20 transitive dependencies/libb/lib.rs
new file mode 100644
index 0000000..e97463b
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/libb/lib.rs
@@ -0,0 +1,3 @@
+pub fn bar() -> i32 {
+ 2 * liba::foo()
+}
diff --git a/test cases/rust/20 transitive dependencies/libb/meson.build b/test cases/rust/20 transitive dependencies/libb/meson.build
new file mode 100644
index 0000000..67947e7
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/libb/meson.build
@@ -0,0 +1,6 @@
+libb = static_library('libb', 'lib.rs',
+ rust_crate_type : 'rlib',
+ dependencies : [liba_dep],
+)
+
+libb_dep = declare_dependency(link_with : libb)
diff --git a/test cases/rust/20 transitive dependencies/main.rs b/test cases/rust/20 transitive dependencies/main.rs
new file mode 100644
index 0000000..4b24845
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("{}", libb::bar());
+}
diff --git a/test cases/rust/20 transitive dependencies/meson.build b/test cases/rust/20 transitive dependencies/meson.build
new file mode 100644
index 0000000..2f378f8
--- /dev/null
+++ b/test cases/rust/20 transitive dependencies/meson.build
@@ -0,0 +1,12 @@
+project('transitive dependencies', 'rust',
+ version : '1.0.0',
+ meson_version : '>= 1.0.0',
+ default_options : ['rust_std=2018'],
+)
+
+subdir('liba')
+subdir('libb')
+
+main = executable('main', 'main.rs',
+ dependencies : [libb_dep],
+)