Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. module Main where
  2.  
  3. import Test.Tasty
  4. import Test1 (hspecTestTree)
  5.  
  6. main :: IO ()
  7. main = hspecTestTree >>= \unitTests ->
  8. let allTests = testGroup "Parser" [unitTests]
  9. in defaultMain allTests
  10.  
  11. ----------------------------------------------------------------------
  12.  
  13. module Test1
  14. ( hspecTestTree
  15. ) where
  16.  
  17. import Data.Maybe
  18. import Task1
  19. import Test.Tasty
  20. import Test.Tasty.Hspec (Spec, describe, it, shouldBe, shouldSatisfy, testSpec)
  21.  
  22. hspecTestTree :: IO TestTree
  23. hspecTestTree = testSpec "Simple parser" spec_Parser
  24.  
  25. spec_Parser :: Spec
  26. spec_Parser = do
  27. describe "eof works" $ do
  28. it "eof on empty input" $
  29. runP eof "" `shouldSatisfy` isJust
  30. it "eof on non-empty input" $
  31. runP eof "x" `shouldSatisfy` isNothing
  32. describe "char works" $ do
  33. it "char parses character" $
  34. runP (element 'a') "abc" `shouldBe` Just ('x', "bc")
  35.  
  36. ----------------------------------------------------------------------
  37.  
  38. name: hw1-second-chance
  39. version: 0.1.0.0
  40. synopsis: Synopsis for task 1
  41. description: Task 1 for FP ITMO course
  42.  
  43. license: MIT
  44. license-file: LICENSE
  45. author: Author name here
  46. maintainer: example@example.com
  47. copyright: 2020 Author name here
  48.  
  49. category: Web
  50. build-type: Simple
  51. extra-source-files: README.md
  52. cabal-version: >=1.10
  53. tested-with: GHC == 8.0.1
  54.  
  55. library
  56. hs-source-dirs: src
  57. exposed-modules: Task1
  58. ghc-options: -Wall
  59. build-depends: base >= 4.9 && < 5
  60. default-language: Haskell2010
  61.  
  62. executable hw1-second-chance
  63. hs-source-dirs: app
  64. main-is: Main.hs
  65. ghc-options: -Wall -Werror -threaded -rtsopts -with-rtsopts=-N
  66. build-depends: base
  67. , hw1-second-chance
  68. default-language: Haskell2010
  69.  
  70. test-suite hw1-second-chance-test
  71. type: exitcode-stdio-1.0
  72. hs-source-dirs: test
  73. main-is: Spec.hs
  74. other-modules: Test1
  75. build-depends: base >= 4.9 && <5
  76. ,tasty
  77. ,tasty-hunit
  78. ,tasty-hspec
  79. ,tasty-quickcheck
  80. ,tasty-smallcheck
  81. ,hw1-second-chance
  82. ghc-options: -Wall -Werror -threaded -rtsopts -with-rtsopts=-N
  83. default-language: Haskell2010
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement