1
Fork 0
mirror of https://github.com/Steffo99/micronfig.git synced 2024-11-23 00:24:18 +00:00
micronfig/micronfig_macros/tests/tests.rs
2024-01-03 04:04:57 +01:00

47 lines
1.1 KiB
Rust

macro_rules! pass {
($id:ident) => {
#[test]
fn $id() {
trybuild::TestCases::new().pass(format!("tests/sources/{}.rs", stringify!($id)));
}
}
}
macro_rules! fail {
($id:ident) => {
#[test]
fn $id() {
trybuild::TestCases::new().compile_fail(format!("tests/sources/{}.rs", stringify!($id)));
}
}
}
pass!(chain_single_down);
pass!(chain_single_up);
pass!(empty);
pass!(from_single_custom);
pass!(parse_single_custom);
pass!(parse_single_i64);
pass!(parse_single_pathbuf);
pass!(parse_single_u64);
pass!(string_multi_explicit);
pass!(string_multi_implicit);
pass!(string_multi_mixed);
pass!(string_single_explicit);
pass!(string_single_implicit);
pass!(tryfrom_single_custom);
fail!(wrong_conversion_longfatarrow);
fail!(wrong_conversion_longthinarrow);
fail!(wrong_conversion_tildearrow);
fail!(wrong_conversion_trait_from);
fail!(wrong_conversion_trait_fromstr);
fail!(wrong_conversion_trait_tryfrom);
fail!(wrong_nonsense_1);
fail!(wrong_nonsense_2);
fail!(wrong_nonsense_3);
fail!(wrong_start);
fail!(wrong_syntax_colon);
fail!(wrong_syntax_type);
fail!(wrong_unqualified_import);
fail!(wrong_unqualified_noimport);