| 1 |
project('rust unit tests', 'rust', meson_version: '>=1.8.0') |
| 2 |
|
| 3 |
t = executable( |
| 4 |
'rust_test', |
| 5 |
['test.rs'], |
| 6 |
rust_args : ['--test'], |
| 7 |
) |
| 8 |
|
| 9 |
test( |
| 10 |
'rust test (should fail)', |
| 11 |
t, |
| 12 |
protocol : 'rust', |
| 13 |
suite : ['foo'], |
| 14 |
should_fail : true, |
| 15 |
) |
| 16 |
|
| 17 |
test( |
| 18 |
'rust test (should pass)', |
| 19 |
t, |
| 20 |
args : ['--skip', 'test_add_intentional_fail'], |
| 21 |
protocol : 'rust', |
| 22 |
suite : ['foo'], |
| 23 |
) |
| 24 |
|
| 25 |
|
| 26 |
test( |
| 27 |
'rust test (should skip)', |
| 28 |
t, |
| 29 |
args : ['--skip', 'test_add'], |
| 30 |
protocol : 'rust', |
| 31 |
suite : ['foo'], |
| 32 |
) |
| 33 |
|
| 34 |
rust = import('rust') |
| 35 |
|
| 36 |
rustdoc = find_program('rustdoc', required: false) |
| 37 |
if rustdoc.found() |
| 38 |
doclib = static_library('rust_doc_lib', ['doctest1.rs'], build_by_default : false) |
| 39 |
rust.doctest('rust doctests', doclib, |
| 40 |
protocol : 'rust', |
| 41 |
suite : ['doctests'], |
| 42 |
) |
| 43 |
|
| 44 |
doclib = shared_library('rust_doc_lib', ['doctest1.rs'], build_by_default : false) |
| 45 |
rust.doctest('rust shared doctests', doclib, |
| 46 |
protocol : 'rust', |
| 47 |
suite : ['doctests'], |
| 48 |
) |
| 49 |
endif |
| 50 |
|
| 51 |
exe = executable('rust_exe', ['test2.rs', 'test.rs'], build_by_default : false) |
| 52 |
|
| 53 |
rust.test('rust_test_from_exe', exe, should_fail : true) |
| 54 |
|
| 55 |
lib = static_library('rust_static', ['test.rs'], build_by_default : false, rust_abi: 'c') |
| 56 |
rust.test('rust_test_from_static', lib, args: ['--skip', 'test_add_intentional_fail']) |
| 57 |
|
| 58 |
lib = shared_library('rust_shared', ['test.rs'], build_by_default : false) |
| 59 |
rust.test('rust_test_from_shared', lib, args: ['--skip', 'test_add_intentional_fail']) |
| 60 |
|
| 61 |
helper = static_library('helper', 'helper.rs') |
| 62 |
lib = static_library('rust_link_with', 'test3.rs', build_by_default : false) |
| 63 |
rust.test('rust_test_link_with', lib, link_with : helper, rust_args : ['--cfg', 'broken="false"']) |