diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-02 19:26:40 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-02 19:28:44 +0200 |
commit | 712654d4c023a2ab13190c6905d313e0ba897965 (patch) | |
tree | b8505b420d6621022fa6a46271340071d8881322 /tests/test/termios.scm | |
parent | Made displayln into a library export. (diff) | |
download | calp-712654d4c023a2ab13190c6905d313e0ba897965.tar.gz calp-712654d4c023a2ab13190c6905d313e0ba897965.tar.xz |
Rewrite test running system.
Diffstat (limited to 'tests/test/termios.scm')
-rw-r--r-- | tests/test/termios.scm | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/tests/test/termios.scm b/tests/test/termios.scm deleted file mode 100644 index 7f607cc4..00000000 --- a/tests/test/termios.scm +++ /dev/null @@ -1,48 +0,0 @@ -;;; Commentary: -;; Tests that my termios function works, at least somewhat. -;; Note that this actually modifies the terminal it's run on, and might fail -;; if the terminal doesn't support the wanted modes. See termios(3). -;; It might also leave the terminal in a broken state if exited prematurely. -;;; Code: - -(define-module (test termios) - :use-module (srfi srfi-64) - :use-module (srfi srfi-88) - :use-module ((hnh util) :select (set!)) - :use-module ((vulgar termios) - :select (make-termios - copy-termios - lflag - tcgetattr! - tcsetattr! - ECHO - ICANON)) - :use-module ((srfi srfi-60) - :select ((bitwise-ior . ||) - (bitwise-not . ~) - (bitwise-and . &)))) - -(define tty (open-input-file "/dev/tty")) - -(define-syntax-rule (&= lvalue val) - (set! lvalue = ((lambda (v) (& v val))))) - -(define t (make-termios)) - -(test-equal 0 (tcgetattr! t tty)) - -(define ifl (lflag t)) - -(define copy (copy-termios t)) - -#!curly-infix {(lflag t) &= (~ (|| ECHO ICANON))} - -(test-equal 0 (tcsetattr! t tty)) - -(test-equal - (& ifl (~ (|| ECHO ICANON))) - (lflag t)) - -(test-equal 0 (tcsetattr! copy tty)) - - |