From 204563751ed907cd507d3a1a2f48bd8c22b5bb97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 23 Apr 2023 19:35:58 +0300 Subject: [PATCH] rust: Add unit test for transitive rust dependencies --- .../rust/20 transitive dependencies/liba/lib.rs | 3 +++ .../rust/20 transitive dependencies/liba/meson.build | 5 +++++ .../rust/20 transitive dependencies/libb/lib.rs | 3 +++ .../rust/20 transitive dependencies/libb/meson.build | 6 ++++++ test cases/rust/20 transitive dependencies/main.rs | 3 +++ .../rust/20 transitive dependencies/meson.build | 12 ++++++++++++ 6 files changed, 32 insertions(+) create mode 100644 test cases/rust/20 transitive dependencies/liba/lib.rs create mode 100644 test cases/rust/20 transitive dependencies/liba/meson.build create mode 100644 test cases/rust/20 transitive dependencies/libb/lib.rs create mode 100644 test cases/rust/20 transitive dependencies/libb/meson.build create mode 100644 test cases/rust/20 transitive dependencies/main.rs create mode 100644 test cases/rust/20 transitive dependencies/meson.build 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 000000000..0fc8ce55f --- /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 000000000..b32822db9 --- /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 000000000..e97463b92 --- /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 000000000..67947e73a --- /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 000000000..4b248456c --- /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 000000000..2f378f88f --- /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], +)