air-spec (empty) → 2013.7.1
raw patch · 6 files changed
+134/−0 lines, 6 filesdep +basedep +hspecdep +textsetup-changed
Dependencies added: base, hspec, text
Files
- LICENSE +31/−0
- Nemesis +28/−0
- Setup.hs +3/−0
- air-spec.cabal +27/−0
- src/Air/Data/PlainShow.hs +31/−0
- src/Air/Spec.hs +14/−0
+ LICENSE view
@@ -0,0 +1,31 @@+Copyright (c) 2013, Jinjing Wang++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jinjing Wang nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Nemesis view
@@ -0,0 +1,28 @@+import System.Nemesis.Titan+import System.Nemesis.Env+import Air.Env+import Prelude ()++main = run - do+ + clean+ [ "**/*.hi"+ , "**/*.o"+ , "manifest"+ ]+ + desc "prepare cabal dist"+ task "dist" - do+ sh "cabal clean"+ sh "cabal configure"+ sh "cabal sdist"++ desc "run shell"+ task "i" - do+ sh "ghci -isrc -XTemplateHaskell src/Test.hs"+ ++ + titan "Test.hs"+ + task "t:Test/titan" - return ()
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple+main = defaultMain+
+ air-spec.cabal view
@@ -0,0 +1,27 @@+Name: air-spec+Version: 2013.7.1+Build-type: Simple+Synopsis: air spec helper+Description: wrapper around shouldBe so error message is Unicode aware+License: BSD3+Author: Jinjing Wang+Maintainer: Jinjing Wang <nfjinjing@gmail.com>+Build-Depends: base+Cabal-version: >= 1.2+category: Development+license-file: LICENSE+homepage: https://github.com/nfjinjing/air-spec+data-files: Nemesis++library++ build-depends: + base >= 4 && < 99+ , text+ , hspec++ hs-source-dirs: src/++ exposed-modules: + Air.Data.PlainShow+ , Air.Spec
+ src/Air/Data/PlainShow.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverlappingInstances #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE TypeSynonymInstances #-}+++module Air.Data.PlainShow where++import Data.Text (Text, unpack)++class (Show a) => PlainShow a where+ plainShow :: a -> String++instance PlainShow String where + plainShow x = x++instance PlainShow Char where + plainShow x = [x]++instance PlainShow Text where+ plainShow = unpack++instance (Show a) => PlainShow a where + plainShow = show+++newtype PlainShowWrapper a = PlainShowWrapper {unPlainShowWrapper :: a }+ deriving (Eq)++instance (PlainShow a) => Show (PlainShowWrapper a) where+ show (PlainShowWrapper x) = plainShow x
+ src/Air/Spec.hs view
@@ -0,0 +1,14 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverlappingInstances #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE TypeSynonymInstances #-}+++module Air.Spec where++import Air.Data.PlainShow+import Test.Hspec (shouldBe, Expectation)++(===) :: (PlainShow a, Eq a) => a -> a -> Expectation+x === y = (PlainShowWrapper x) `shouldBe` (PlainShowWrapper y)+infixr 0 ===