Skip to content

Commit 13b17d0

Browse files
committed
test: Add disable overrun test
1 parent 17f59f3 commit 13b17d0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

testsuite/tests/uart.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,28 @@ mod tests {
411411

412412
state.serial1 = Some(serial);
413413
}
414+
415+
#[test]
416+
fn test_disabled_overrun(state: &mut super::State) {
417+
let mut serial = state.serial1.take().unwrap();
418+
419+
serial.detect_overrun(false);
420+
while serial.is_busy() {}
421+
422+
// Writ the whole TEST_MSG content and check if the last bit
423+
// is in the register.
424+
unwrap!(serial.bwrite_all(&TEST_MSG));
425+
unwrap!(serial.bflush());
426+
assert_eq!(
427+
unwrap!(nb::block!(serial.read())),
428+
*TEST_MSG.iter().rev().next().unwrap()
429+
);
430+
431+
// enable overrun again.
432+
serial.detect_overrun(true);
433+
434+
state.serial1 = Some(serial);
435+
}
414436
}
415437

416438
// TODO: This maybe can be moved into a function inside the

0 commit comments

Comments
 (0)