Skip to content

Commit 5f6b933

Browse files
authored
Add Android.bp entries for googletest and mockall example tests (#2643)
1 parent 4ee2337 commit 5f6b933

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/android/testing/Android.bp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,19 @@ rust_test {
1111
host_supported: true,
1212
test_suites: ["general-tests"],
1313
}
14+
15+
rust_test {
16+
name: "libgoogletest_example",
17+
crate_name: "googletest_example",
18+
srcs: ["googletest.rs"],
19+
rustlibs: ["libgoogletest_rust"],
20+
host_supported: true,
21+
}
22+
23+
rust_test {
24+
name: "libmockall_example",
25+
crate_name: "mockall_example",
26+
srcs: ["mockall.rs"],
27+
rustlibs: ["libmockall"],
28+
host_supported: true,
29+
}

src/android/testing/mockall.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub trait Pet {
1010
fn test_robot_dog() {
1111
let mut mock_dog = MockPet::new();
1212
mock_dog.expect_is_hungry().return_const(true);
13-
assert_eq!(mock_dog.is_hungry(Duration::from_secs(10)), true);
13+
assert!(mock_dog.is_hungry(Duration::from_secs(10)));
1414
}
1515
// ANCHOR_END: simple_example
1616

@@ -23,7 +23,7 @@ fn test_robot_cat() {
2323
.with(mockall::predicate::gt(Duration::from_secs(3 * 3600)))
2424
.return_const(true);
2525
mock_cat.expect_is_hungry().return_const(false);
26-
assert_eq!(mock_cat.is_hungry(Duration::from_secs(1 * 3600)), false);
27-
assert_eq!(mock_cat.is_hungry(Duration::from_secs(5 * 3600)), true);
26+
assert!(mock_cat.is_hungry(Duration::from_secs(5 * 3600)));
27+
assert!(!mock_cat.is_hungry(Duration::from_secs(5)));
2828
}
2929
// ANCHOR_END: extended_example

0 commit comments

Comments
 (0)