Merge changes from topic "rust_aconfig-test-mode" into main
* changes: Add rust_test with rust_aconfig_library in test mode Fix rust aconfig test
This commit is contained in:
commit
73b4f2d4e2
4 changed files with 50 additions and 9 deletions
|
@ -160,11 +160,28 @@ rust_aconfig_library {
|
|||
}
|
||||
|
||||
rust_test {
|
||||
name: "aconfig.test.rust",
|
||||
name: "aconfig.prod_mode.test.rust",
|
||||
srcs: [
|
||||
"tests/aconfig_test.rs"
|
||||
"tests/aconfig_prod_mode_test.rs"
|
||||
],
|
||||
rustlibs: [
|
||||
"libaconfig_test_rust_library",
|
||||
],
|
||||
}
|
||||
|
||||
rust_aconfig_library {
|
||||
name: "libaconfig_test_rust_library_with_test_mode",
|
||||
crate_name: "aconfig_test_rust_library",
|
||||
aconfig_declarations: "aconfig.test.flags",
|
||||
test: true,
|
||||
}
|
||||
|
||||
rust_test {
|
||||
name: "aconfig.test_mode.test.rust",
|
||||
srcs: [
|
||||
"tests/aconfig_test_mode_test.rs"
|
||||
],
|
||||
rustlibs: [
|
||||
"libaconfig_test_rust_library_with_test_mode",
|
||||
],
|
||||
}
|
8
tools/aconfig/tests/aconfig_prod_mode_test.rs
Normal file
8
tools/aconfig/tests/aconfig_prod_mode_test.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
#[test]
|
||||
fn test_flags() {
|
||||
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||
// TODO: Fix template to not default both disabled and enabled to false
|
||||
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#[test]
|
||||
fn test_flags() {
|
||||
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||
assert!(aconfig_test_rust_library::enabled_ro());
|
||||
assert!(aconfig_test_rust_library::enabled_rw());
|
||||
}
|
23
tools/aconfig/tests/aconfig_test_mode_test.rs
Normal file
23
tools/aconfig/tests/aconfig_test_mode_test.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
#[test]
|
||||
fn test_flags() {
|
||||
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||
// TODO: Fix template to not default both disabled and enabled to false
|
||||
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||
|
||||
aconfig_test_rust_library::set_disabled_ro(true);
|
||||
assert!(aconfig_test_rust_library::disabled_ro());
|
||||
aconfig_test_rust_library::set_disabled_rw(true);
|
||||
assert!(aconfig_test_rust_library::disabled_rw());
|
||||
aconfig_test_rust_library::set_enabled_ro(true);
|
||||
assert!(aconfig_test_rust_library::enabled_ro());
|
||||
aconfig_test_rust_library::set_enabled_rw(true);
|
||||
assert!(aconfig_test_rust_library::enabled_rw());
|
||||
|
||||
aconfig_test_rust_library::reset_flags();
|
||||
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||
}
|
Loading…
Reference in a new issue