Add tests to 'terminal_size'
This commit is contained in:
parent
5d4826d4ff
commit
08746c0d2a
|
@ -24,6 +24,7 @@ Features
|
|||
- Redox support.
|
||||
- 256-color mode.
|
||||
- Panic-free error handling.
|
||||
- Special keys events.
|
||||
|
||||
and much more.
|
||||
|
||||
|
|
|
@ -101,11 +101,11 @@ impl<R: Read> TermRead for R {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
#[test]
|
||||
fn test_keys() {
|
||||
use {TermRead, Key};
|
||||
|
||||
let mut i = b"\x1Bayo\x7F\x1B[D".keys();
|
||||
|
||||
assert_eq!(i.next(), Some(Key::Alt('a')));
|
||||
|
|
10
src/size.rs
10
src/size.rs
|
@ -57,3 +57,13 @@ pub fn terminal_size() -> Result<(usize, usize), TerminalError> {
|
|||
|
||||
Ok((try!(w), try!(h)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_size() {
|
||||
assert!(terminal_size().is_ok());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ pub const TIOCGWINSZ: usize = 0x00005413;
|
|||
pub const TIOCGWINSZ: usize = 0x40087468;
|
||||
|
||||
extern {
|
||||
pub fn tcgetattr(filedes: c_int, termptr: *mut Termios) -> c_int;
|
||||
pub fn tcsetattr(filedes: c_int, opt: c_int, termptr: *mut Termios) -> c_int;
|
||||
pub fn tcgetattr(fd: c_int, termptr: *mut Termios) -> c_int;
|
||||
pub fn tcsetattr(fd: c_int, opt: c_int, termptr: *mut Termios) -> c_int;
|
||||
pub fn cfmakeraw(termptr: *mut Termios);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue