From cbe30a71a33f5ba6abb803480b8bae00368300b4 Mon Sep 17 00:00:00 2001 From: Corey O'Connor Date: Thu, 14 Aug 2014 15:08:44 -0700 Subject: [PATCH] update tests for changes in config process --- test/VerifyConfig.hs | 7 ------- test/VerifyOutput.hs | 9 ++++++--- test/VerifyUsingMockInput.hs | 7 ++++++- vty.cabal | 33 +++++++++++++++++---------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/test/VerifyConfig.hs b/test/VerifyConfig.hs index 75ea4b9..13d44db 100644 --- a/test/VerifyConfig.hs +++ b/test/VerifyConfig.hs @@ -4,11 +4,6 @@ module Main where import Graphics.Vty.Config import Graphics.Vty.Input.Events -import Control.Applicative -import Control.Exception -import Control.Lens ((^.)) -import Control.Monad - import Data.Default import Data.String.QQ @@ -16,8 +11,6 @@ import Test.Framework import Test.Framework.Providers.HUnit import Test.HUnit hiding (Test) -import Text.Printf - exampleConfig :: String exampleConfig = [s| -- comments should be ignored. diff --git a/test/VerifyOutput.hs b/test/VerifyOutput.hs index 8774c80..3d179ee 100644 --- a/test/VerifyOutput.hs +++ b/test/VerifyOutput.hs @@ -12,9 +12,11 @@ import Verify.Graphics.Vty.Output import Control.Monad +import Data.Default + import qualified System.Console.Terminfo as Terminfo import System.Posix.Env -import System.IO +import System.Posix.IO tests :: IO [Test] tests = concat <$> forM terminalsOfInterest (\termName -> do @@ -45,8 +47,8 @@ smokeTestTermMac termName i = liftIOResult $ do smokeTestTerm :: String -> Image -> IO Result smokeTestTerm termName i = do - nullOut <- openFile "/dev/null" WriteMode - t <- outputForNameAndIO termName nullOut + nullOut <- openFd "/dev/null" WriteOnly Nothing defaultFileFlags + t <- outputForConfig $ def { outputFd = Just nullOut, termName = Just termName } -- putStrLn $ "context color count: " ++ show (contextColorCount t) reserveDisplay t dc <- displayContext t (100,100) @@ -59,5 +61,6 @@ smokeTestTerm termName i = do showCursor t releaseDisplay t releaseTerminal t + closeFd nullOut return succeeded diff --git a/test/VerifyUsingMockInput.hs b/test/VerifyUsingMockInput.hs index 00ea343..63d5318 100644 --- a/test/VerifyUsingMockInput.hs +++ b/test/VerifyUsingMockInput.hs @@ -110,7 +110,12 @@ assertEventsFromSynInput table inputSpec expectedEvents = do (writeFd, readFd) <- openPseudoTerminal (setTermAttr,_) <- attributeControl readFd setTermAttr - input <- initInputForFd def "dummy" table readFd + let testConfig = def { inputFd = Just readFd + , termName = Just "dummy" + , vmin = Just 1 + , vtime = Just 100 + } + input <- initInput testConfig table eventsRef <- newIORef [] let writeWaitClose = do synthesizeInput inputSpec writeFd diff --git a/vty.cabal b/vty.cabal index 61424fb..c8a40c7 100644 --- a/vty.cabal +++ b/vty.cabal @@ -137,7 +137,7 @@ test-suite verify-attribute-ops hs-source-dirs: test test-module: VerifyAttributeOps build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -169,7 +169,7 @@ test-suite verify-using-mock-terminal Verify.Graphics.Vty.Output build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -202,12 +202,13 @@ test-suite verify-terminal Verify.Graphics.Vty.Output build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, bytestring, containers, + data-default >= 0.5.3, deepseq >= 1.1 && < 1.4, mtl >= 1.1.1.0 && < 2.3, terminfo >= 0.3 && < 0.5, @@ -235,7 +236,7 @@ test-suite verify-display-attributes Verify.Graphics.Vty.Span build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -261,7 +262,7 @@ test-suite verify-empty-image-props other-modules: Verify build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -288,7 +289,7 @@ test-suite verify-eval-terminfo-caps Verify.Graphics.Vty.Output build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -318,7 +319,7 @@ test-suite verify-image-ops Verify.Graphics.Vty.Image build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -346,7 +347,7 @@ test-suite verify-image-trans Verify.Graphics.Vty.Image build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -373,7 +374,7 @@ test-suite verify-inline Verify.Graphics.Vty.Output build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -401,7 +402,7 @@ test-suite verify-parse-terminfo-caps Verify.Graphics.Vty.Output build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -433,7 +434,7 @@ test-suite verify-simple-span-generation Verify.Graphics.Vty.Span build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -465,7 +466,7 @@ test-suite verify-crop-span-generation Verify.Graphics.Vty.Span build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -497,7 +498,7 @@ test-suite verify-layers-span-generation Verify.Graphics.Vty.Span build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -523,7 +524,7 @@ test-suite verify-utf8-width other-modules: Verify build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, QuickCheck >= 2.4, random == 1.0.*, base >= 4 && < 5, @@ -547,7 +548,7 @@ test-suite verify-using-mock-input main-is: VerifyUsingMockInput.hs build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, data-default >= 0.5.3, QuickCheck >= 2.4, smallcheck == 1.*, @@ -580,7 +581,7 @@ test-suite verify-config main-is: VerifyConfig.hs build-depends: vty, - Cabal == 1.18.*, + Cabal >= 1.18, data-default >= 0.5.3, HUnit, QuickCheck >= 2.4,