aboutsummaryrefslogtreecommitdiffstats
path: root/tests/basic.rs
blob: 71ed857c41382e1931e2a5daacedc06705576d09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();
    });
}