Merge changes from topic "rust_aconfig-test-mode" into main am: 73b4f2d4e2 am: 31fdd70294 am: 20288ab1cd am: e17aa8ad16 am: b213bccfbd

Original change: https://android-review.googlesource.com/c/platform/build/+/2706433

Change-Id: Ic1dd8d720091f40a92ce54d0c5a3698132b9df95
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vinh Tran 2023-08-17 17:11:53 +00:00 committed by Automerger Merge Worker
commit a2e7dae501
4 changed files with 50 additions and 9 deletions

View file

@ -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",
],
}

View 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());
}

View file

@ -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());
}

View 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());
}