diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-03-12 15:33:31 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-03-12 15:33:31 -0500 |
commit | f069116b8c71775b3a6c83c247608eabc9b6fec1 (patch) | |
tree | 261ef405833dd3f4324ad2f06674bd846dfb77a5 /tests/basic.rs | |
parent | 3ad62c9428e2ca9411f7b993909ce52207871e2d (diff) | |
download | textmode-f069116b8c71775b3a6c83c247608eabc9b6fec1.tar.gz textmode-f069116b8c71775b3a6c83c247608eabc9b6fec1.zip |
add some test scaffolding
Diffstat (limited to 'tests/basic.rs')
-rw-r--r-- | tests/basic.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/basic.rs b/tests/basic.rs new file mode 100644 index 0000000..71ed857 --- /dev/null +++ b/tests/basic.rs @@ -0,0 +1,23 @@ +use std::io::Write as _; +use std::os::unix::io::AsRawFd as _; + +mod fixtures; + +#[test] +fn test_basic() { + fixtures::run_fixture("basic", true, |pty| { + pty.write_all(b"a").unwrap(); + assert_eq!(fixtures::read(pty), b"\x1b[6;6Hfoo"); + + pty.write_all(b"a").unwrap(); + assert!(!fixtures::read_ready(pty.as_raw_fd())); + + pty.write_all(b"a").unwrap(); + assert_eq!( + fixtures::read(pty), + b"\x1b[9;9H\x1b[32mbar\x1b[12;12H\x1b[mbaz" + ); + + pty.write_all(b"a").unwrap(); + }); +} |