on 2e7bc4c help sign in
vty/test/VerifyUsingMockInput.hs
38 lines 1.1 kB history raw
1{- We setup the environment to envoke certain terminals of interest.
2 - This assumes appropriate definitions exist in the current environment for the terminals of
3 - interest.
4 -}
5module VerifyUsingMockInput where
6import Verify
8import Graphics.Vty
10import Control.Concurrent
11import Control.Monad
13import System.Posix.Env
14import System.IO
16data InputEvent
17 = Bytes String -- | input sequence encoded as a string. Regardless, the input is read a byte at a time.
18 | Delay Int -- | millisecond delay
20type InputSpec = [InputEvent]
22type ExpectedSpec = [Event]
24exec_input_spec :: InputSpec -> Handle -> IO ()
25exec_input_spec input out_handle = forM_ input f
26 where
27 f (Bytes str) = hPutStr out_handle str >> hFlush out_handle
28 f (Delay t) = threadDelay (t*1000)
30assert_events_from_IO_reads :: InputSpec -> ExpectedSpec -> IO Result
31assert_events_from_IO_reads input events = undefined
33assert_events_from_input_block :: InputSpec -> ExpectedSpec -> Result
34assert_events_from_input_block input events = undefined
36tests :: IO [Test]
37tests = return []