rust: Add unit test for transitive rust dependencies

This commit is contained in:
Sebastian Dröge 2023-04-23 19:35:58 +03:00 committed by Xavier Claessens
parent 3500349df1
commit 204563751e
6 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,3 @@
pub fn foo() -> i32 {
123
}

View File

@ -0,0 +1,5 @@
liba = static_library('liba', 'lib.rs',
rust_crate_type : 'rlib',
)
liba_dep = declare_dependency(link_with : liba)

View File

@ -0,0 +1,3 @@
pub fn bar() -> i32 {
2 * liba::foo()
}

View File

@ -0,0 +1,6 @@
libb = static_library('libb', 'lib.rs',
rust_crate_type : 'rlib',
dependencies : [liba_dep],
)
libb_dep = declare_dependency(link_with : libb)

View File

@ -0,0 +1,3 @@
fn main() {
println!("{}", libb::bar());
}

View File

@ -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],
)