1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

term: fix vlib/term/termios/termios_test.v on windows

This commit is contained in:
Delyan Angelov 2023-07-31 14:22:03 +03:00
parent 367289a1f1
commit 81e99a2af3
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,20 @@
module termios module termios
fn test_portable() {
assert 123 == int(flag(123))
o := Termios{
c_lflag: flag(0xFFFF)
} // assume c_lflag exists everywhere
// dump( o.c_lflag )
mut n := o
n.c_lflag &= invert(1)
// dump( n.c_lflag )
assert n.c_lflag != o.c_lflag
n.disable_echo() // just assume it exists, and can be called everywhere
assert true
}
[if !windows]
fn test_termios() { fn test_termios() {
mut original_term := Termios{} mut original_term := Termios{}
tcgetattr(0, mut original_term) tcgetattr(0, mut original_term)

View File

@ -27,6 +27,15 @@ pub fn invert(value TcFlag) TcFlag {
} }
pub struct Termios { pub struct Termios {
pub mut:
c_iflag TcFlag
c_oflag TcFlag
c_cflag TcFlag
c_lflag TcFlag
c_line Cc
c_cc [32]Cc
c_ispeed Speed
c_ospeed Speed
} }
// tcgetattr is an unsafe wrapper around C.termios and keeps its semantic // tcgetattr is an unsafe wrapper around C.termios and keeps its semantic