on master help sign in
update tests for changes in config process
cbe30a7Corey O'Connor
test/VerifyConfig.hs−7
@@ -4,11 +4,6 @@ module Main where
4import Graphics.Vty.Config
4import Graphics.Vty.Config
5import Graphics.Vty.Input.Events
5import Graphics.Vty.Input.Events
6
6
7−import Control.Applicative
8−import Control.Exception
9−import Control.Lens ((^.))
10−import Control.Monad
11−
12import Data.Default
7import Data.Default
13import Data.String.QQ
8import Data.String.QQ
14
9
@@ -16,8 +11,6 @@ import Test.Framework
16import Test.Framework.Providers.HUnit
11import Test.Framework.Providers.HUnit
17import Test.HUnit hiding (Test)
12import Test.HUnit hiding (Test)
18
13
19−import Text.Printf
20−
21exampleConfig :: String
14exampleConfig :: String
22exampleConfig = [s|
15exampleConfig = [s|
23-- comments should be ignored.
16-- comments should be ignored.
test/VerifyOutput.hs+6−3
@@ -12,9 +12,11 @@ import Verify.Graphics.Vty.Output
12
12
13import Control.Monad
13import Control.Monad
14
14
15+import Data.Default
16+
15import qualified System.Console.Terminfo as Terminfo
17import qualified System.Console.Terminfo as Terminfo
16import System.Posix.Env
18import System.Posix.Env
17−import System.IO
19+import System.Posix.IO
18
20
19tests :: IO [Test]
21tests :: IO [Test]
20tests = concat <$> forM terminalsOfInterest (\termName -> do
22tests = concat <$> forM terminalsOfInterest (\termName -> do
@@ -45,8 +47,8 @@ smokeTestTermMac termName i = liftIOResult $ do
45
47
46smokeTestTerm :: String -> Image -> IO Result
48smokeTestTerm :: String -> Image -> IO Result
47smokeTestTerm termName i = do
49smokeTestTerm termName i = do
48− nullOut <- openFile "/dev/null" WriteMode
50+ nullOut <- openFd "/dev/null" WriteOnly Nothing defaultFileFlags
49− t <- outputForNameAndIO termName nullOut
51+ t <- outputForConfig $ def { outputFd = Just nullOut, termName = Just termName }
50 -- putStrLn $ "context color count: " ++ show (contextColorCount t)
52 -- putStrLn $ "context color count: " ++ show (contextColorCount t)
51 reserveDisplay t
53 reserveDisplay t
52 dc <- displayContext t (100,100)
54 dc <- displayContext t (100,100)
@@ -59,5 +61,6 @@ smokeTestTerm termName i = do
59 showCursor t
61 showCursor t
60 releaseDisplay t
62 releaseDisplay t
61 releaseTerminal t
63 releaseTerminal t
64+ closeFd nullOut
62 return succeeded
65 return succeeded
63
66
test/VerifyUsingMockInput.hs+6−1
@@ -110,7 +110,12 @@ assertEventsFromSynInput table inputSpec expectedEvents = do
110 (writeFd, readFd) <- openPseudoTerminal
110 (writeFd, readFd) <- openPseudoTerminal
111 (setTermAttr,_) <- attributeControl readFd
111 (setTermAttr,_) <- attributeControl readFd
112 setTermAttr
112 setTermAttr
113− input <- initInputForFd def "dummy" table readFd
113+ let testConfig = def { inputFd = Just readFd
114+ , termName = Just "dummy"
115+ , vmin = Just 1
116+ , vtime = Just 100
117+ }
118+ input <- initInput testConfig table
114 eventsRef <- newIORef []
119 eventsRef <- newIORef []
115 let writeWaitClose = do
120 let writeWaitClose = do
116 synthesizeInput inputSpec writeFd
121 synthesizeInput inputSpec writeFd
vty.cabal+17−16
@@ -137,7 +137,7 @@ test-suite verify-attribute-ops
137 hs-source-dirs: test
137 hs-source-dirs: test
138 test-module: VerifyAttributeOps
138 test-module: VerifyAttributeOps
139 build-depends: vty,
139 build-depends: vty,
140− Cabal == 1.18.*,
140+ Cabal >= 1.18,
141 QuickCheck >= 2.4,
141 QuickCheck >= 2.4,
142 random == 1.0.*,
142 random == 1.0.*,
143 base >= 4 && < 5,
143 base >= 4 && < 5,
@@ -169,7 +169,7 @@ test-suite verify-using-mock-terminal
169 Verify.Graphics.Vty.Output
169 Verify.Graphics.Vty.Output
170
170
171 build-depends: vty,
171 build-depends: vty,
172− Cabal == 1.18.*,
172+ Cabal >= 1.18,
173 QuickCheck >= 2.4,
173 QuickCheck >= 2.4,
174 random == 1.0.*,
174 random == 1.0.*,
175 base >= 4 && < 5,
175 base >= 4 && < 5,
@@ -202,12 +202,13 @@ test-suite verify-terminal
202 Verify.Graphics.Vty.Output
202 Verify.Graphics.Vty.Output
203
203
204 build-depends: vty,
204 build-depends: vty,
205− Cabal == 1.18.*,
205+ Cabal >= 1.18,
206 QuickCheck >= 2.4,
206 QuickCheck >= 2.4,
207 random == 1.0.*,
207 random == 1.0.*,
208 base >= 4 && < 5,
208 base >= 4 && < 5,
209 bytestring,
209 bytestring,
210 containers,
210 containers,
211+ data-default >= 0.5.3,
211 deepseq >= 1.1 && < 1.4,
212 deepseq >= 1.1 && < 1.4,
212 mtl >= 1.1.1.0 && < 2.3,
213 mtl >= 1.1.1.0 && < 2.3,
213 terminfo >= 0.3 && < 0.5,
214 terminfo >= 0.3 && < 0.5,
@@ -235,7 +236,7 @@ test-suite verify-display-attributes
235 Verify.Graphics.Vty.Span
236 Verify.Graphics.Vty.Span
236
237
237 build-depends: vty,
238 build-depends: vty,
238− Cabal == 1.18.*,
239+ Cabal >= 1.18,
239 QuickCheck >= 2.4,
240 QuickCheck >= 2.4,
240 random == 1.0.*,
241 random == 1.0.*,
241 base >= 4 && < 5,
242 base >= 4 && < 5,
@@ -261,7 +262,7 @@ test-suite verify-empty-image-props
261 other-modules: Verify
262 other-modules: Verify
262
263
263 build-depends: vty,
264 build-depends: vty,
264− Cabal == 1.18.*,
265+ Cabal >= 1.18,
265 QuickCheck >= 2.4,
266 QuickCheck >= 2.4,
266 random == 1.0.*,
267 random == 1.0.*,
267 base >= 4 && < 5,
268 base >= 4 && < 5,
@@ -288,7 +289,7 @@ test-suite verify-eval-terminfo-caps
288 Verify.Graphics.Vty.Output
289 Verify.Graphics.Vty.Output
289
290
290 build-depends: vty,
291 build-depends: vty,
291− Cabal == 1.18.*,
292+ Cabal >= 1.18,
292 QuickCheck >= 2.4,
293 QuickCheck >= 2.4,
293 random == 1.0.*,
294 random == 1.0.*,
294 base >= 4 && < 5,
295 base >= 4 && < 5,
@@ -318,7 +319,7 @@ test-suite verify-image-ops
318 Verify.Graphics.Vty.Image
319 Verify.Graphics.Vty.Image
319
320
320 build-depends: vty,
321 build-depends: vty,
321− Cabal == 1.18.*,
322+ Cabal >= 1.18,
322 QuickCheck >= 2.4,
323 QuickCheck >= 2.4,
323 random == 1.0.*,
324 random == 1.0.*,
324 base >= 4 && < 5,
325 base >= 4 && < 5,
@@ -346,7 +347,7 @@ test-suite verify-image-trans
346 Verify.Graphics.Vty.Image
347 Verify.Graphics.Vty.Image
347
348
348 build-depends: vty,
349 build-depends: vty,
349− Cabal == 1.18.*,
350+ Cabal >= 1.18,
350 QuickCheck >= 2.4,
351 QuickCheck >= 2.4,
351 random == 1.0.*,
352 random == 1.0.*,
352 base >= 4 && < 5,
353 base >= 4 && < 5,
@@ -373,7 +374,7 @@ test-suite verify-inline
373 Verify.Graphics.Vty.Output
374 Verify.Graphics.Vty.Output
374
375
375 build-depends: vty,
376 build-depends: vty,
376− Cabal == 1.18.*,
377+ Cabal >= 1.18,
377 QuickCheck >= 2.4,
378 QuickCheck >= 2.4,
378 random == 1.0.*,
379 random == 1.0.*,
379 base >= 4 && < 5,
380 base >= 4 && < 5,
@@ -401,7 +402,7 @@ test-suite verify-parse-terminfo-caps
401 Verify.Graphics.Vty.Output
402 Verify.Graphics.Vty.Output
402
403
403 build-depends: vty,
404 build-depends: vty,
404− Cabal == 1.18.*,
405+ Cabal >= 1.18,
405 QuickCheck >= 2.4,
406 QuickCheck >= 2.4,
406 random == 1.0.*,
407 random == 1.0.*,
407 base >= 4 && < 5,
408 base >= 4 && < 5,
@@ -433,7 +434,7 @@ test-suite verify-simple-span-generation
433 Verify.Graphics.Vty.Span
434 Verify.Graphics.Vty.Span
434
435
435 build-depends: vty,
436 build-depends: vty,
436− Cabal == 1.18.*,
437+ Cabal >= 1.18,
437 QuickCheck >= 2.4,
438 QuickCheck >= 2.4,
438 random == 1.0.*,
439 random == 1.0.*,
439 base >= 4 && < 5,
440 base >= 4 && < 5,
@@ -465,7 +466,7 @@ test-suite verify-crop-span-generation
465 Verify.Graphics.Vty.Span
466 Verify.Graphics.Vty.Span
466
467
467 build-depends: vty,
468 build-depends: vty,
468− Cabal == 1.18.*,
469+ Cabal >= 1.18,
469 QuickCheck >= 2.4,
470 QuickCheck >= 2.4,
470 random == 1.0.*,
471 random == 1.0.*,
471 base >= 4 && < 5,
472 base >= 4 && < 5,
@@ -497,7 +498,7 @@ test-suite verify-layers-span-generation
497 Verify.Graphics.Vty.Span
498 Verify.Graphics.Vty.Span
498
499
499 build-depends: vty,
500 build-depends: vty,
500− Cabal == 1.18.*,
501+ Cabal >= 1.18,
501 QuickCheck >= 2.4,
502 QuickCheck >= 2.4,
502 random == 1.0.*,
503 random == 1.0.*,
503 base >= 4 && < 5,
504 base >= 4 && < 5,
@@ -523,7 +524,7 @@ test-suite verify-utf8-width
523 other-modules: Verify
524 other-modules: Verify
524
525
525 build-depends: vty,
526 build-depends: vty,
526− Cabal == 1.18.*,
527+ Cabal >= 1.18,
527 QuickCheck >= 2.4,
528 QuickCheck >= 2.4,
528 random == 1.0.*,
529 random == 1.0.*,
529 base >= 4 && < 5,
530 base >= 4 && < 5,
@@ -547,7 +548,7 @@ test-suite verify-using-mock-input
547 main-is: VerifyUsingMockInput.hs
548 main-is: VerifyUsingMockInput.hs
548
549
549 build-depends: vty,
550 build-depends: vty,
550− Cabal == 1.18.*,
551+ Cabal >= 1.18,
551 data-default >= 0.5.3,
552 data-default >= 0.5.3,
552 QuickCheck >= 2.4,
553 QuickCheck >= 2.4,
553 smallcheck == 1.*,
554 smallcheck == 1.*,
@@ -580,7 +581,7 @@ test-suite verify-config
580 main-is: VerifyConfig.hs
581 main-is: VerifyConfig.hs
581
582
582 build-depends: vty,
583 build-depends: vty,
583− Cabal == 1.18.*,
584+ Cabal >= 1.18,
584 data-default >= 0.5.3,
585 data-default >= 0.5.3,
585 HUnit,
586 HUnit,
586 QuickCheck >= 2.4,
587 QuickCheck >= 2.4,