"Fossies" - the Fresh Open Source Software Archive

Member "pp-2.7.4/test/Spec.hs" (5 May 2019, 1794 Bytes) of package /linux/privat/pp-2.7.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Haskell source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "Spec.hs": 2.7.1_vs_2.7.2.

    1 {- PP
    2 
    3 Copyright (C) 2015-2019 Christophe Delord
    4 
    5 https://www.cdsoft.fr/pp
    6 
    7 This file is part of PP.
    8 
    9 PP is free software: you can redistribute it and/or modify
   10 it under the terms of the GNU General Public License as published by
   11 the Free Software Foundation, either version 3 of the License, or
   12 (at your option) any later version.
   13 
   14 PP is distributed in the hope that it will be useful,
   15 but WITHOUT ANY WARRANTY; without even the implied warranty of
   16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17 GNU General Public License for more details.
   18 
   19 You should have received a copy of the GNU General Public License
   20 along with PP.  If not, see <http://www.gnu.org/licenses/>.
   21 -}
   22 
   23 import Test.Hspec
   24 
   25 import Environment
   26 import Preprocessor
   27 
   28 import Data.List
   29 import Control.Monad
   30 
   31 main :: IO ()
   32 main = hspec $ do
   33 
   34     describe "Preprocessor" $ do
   35         it "defines disjoint character sets" $ do
   36             let sets = defaultMacroChars
   37                        ++ concat [ [o,c] | (o,c) <- defaultOpenCloseChars ]
   38                        ++ defaultBlockChars
   39                        ++ defaultLiterateMacroChars
   40             nub sets `shouldBe` sets
   41         it "defines at least one macro call char" $ defaultMacroChars `shouldNotBe` []
   42         it "defines at least one kind of parentheses" $ defaultOpenCloseChars `shouldNotBe` []
   43         it "defines at least one kind of block delimiter" $ defaultBlockChars `shouldNotBe` []
   44         it "defines at least one literate macro char" $ defaultLiterateMacroChars `shouldNotBe` []
   45 
   46     describe "Documentation" $
   47         forM_ builtin $ \(Macro name _ doc _) -> do
   48             it ("the docstring of '!"++name++"' starts with `!") $ take 2 doc `shouldBe` "`!"
   49             it ("the docstring of '!"++name++"' ends with .") $ last doc `shouldBe` '.'