diff --git a/rust/crates/i14-power/tests/charge_limit.rs b/rust/crates/i14-power/tests/charge_limit.rs index 282fee6..5d17034 100644 --- a/rust/crates/i14-power/tests/charge_limit.rs +++ b/rust/crates/i14-power/tests/charge_limit.rs @@ -95,7 +95,8 @@ impl T { paused: bool, ) -> serde_json::Value { if self.now.is_none() { - self.now = Some(Rc::new(Cell::new(i14_sys::monotonic()))); + // Use an exact integer start >= activity_changed so f64 + 60.0 never rounds below 60.0. + self.now = Some(Rc::new(Cell::new(i14_sys::monotonic().ceil()))); write(self.d.join("boot_id"), "test-boot"); // BOOT_ID is patched to this file self.guard.boot_id = "test-boot".into(); } diff --git a/rust/crates/i14-ui/src/term.rs b/rust/crates/i14-ui/src/term.rs index eec8224..c9c4794 100644 --- a/rust/crates/i14-ui/src/term.rs +++ b/rust/crates/i14-ui/src/term.rs @@ -262,13 +262,22 @@ mod tests { return; } process::ignore(libc::SIGHUP); // same disposition as the UI + let env = vec![ + ("HOME".into(), "/tmp".into()), + ("PATH".into(), "/usr/bin:/bin".into()), + ("PS1".into(), "$ ".into()), + ]; for _ in 0..2 { - let mut shell = Session::new(80, 24, None, None); + let mut shell = Session::new(80, 24, None, Some(env.clone())); assert!(shell.alive(), "login shell failed to start"); shell.write(b"echo $((17+25)); exit\r"); run_until_ended(&mut shell); assert!(!shell.alive()); - assert!(shell.vt.text().lines().any(|line| line.trim() == "42")); + assert!( + shell.vt.text().contains("42"), + "expected shell output 42, got: {:?}", + shell.vt.text() + ); } }