on master help sign in
Reorganize test directory
e5e55b1Evan Czaplicki
elm-compiler.cabal+5−5
@@ -191,15 +191,15 @@ Test-Suite compiler-tests
191 exitcode-stdio-1.0
191 exitcode-stdio-1.0
192
192
193 Hs-Source-Dirs:
193 Hs-Source-Dirs:
194− tests/compiler, src
194+ tests, src
195
195
196 Main-is:
196 Main-is:
197− CompilerTest.hs
197+ Test.hs
198
198
199 other-modules:
199 other-modules:
200− Tests.Compiler
200+ Test.Compiler
201− Tests.Property
201+ Test.Property
202− Tests.Property.Arbitrary
202+ Test.Property.Arbitrary
203 AST.Helpers
203 AST.Helpers
204 AST.Literal
204 AST.Literal
205 AST.PrettyPrint
205 AST.PrettyPrint
tests/compiler/CompilerTest.hs → tests/Test.hsrenamed+3−2
@@ -2,8 +2,9 @@ module Main where
2
2
3import Test.Framework
3import Test.Framework
4
4
5−import Tests.Compiler
5+import Test.Compiler
6−import Tests.Property
6+import Test.Property
7+
7
8
8main :: IO ()
9main :: IO ()
9main =
10main =
tests/compiler/Tests/Compiler.hs → tests/Test/Compiler.hsrenamed+1−1
@@ -1,5 +1,5 @@
1{-# OPTIONS_GHC -W #-}
1{-# OPTIONS_GHC -W #-}
2−module Tests.Compiler (compilerTests) where
2+module Test.Compiler (compilerTests) where
3
3
4import qualified Data.Map as Map
4import qualified Data.Map as Map
5import Data.Traversable (traverse)
5import Data.Traversable (traverse)
tests/compiler/Tests/Property.hs → tests/Test/Property.hsrenamed+17−5
@@ -1,4 +1,4 @@
1−module Tests.Property where
1+module Test.Property where
2
2
3import Control.Applicative ((<*))
3import Control.Applicative ((<*))
4import Test.Framework
4import Test.Framework
@@ -17,7 +17,8 @@ import Parse.Helpers (IParser, iParse)
17import Parse.Literal (literal)
17import Parse.Literal (literal)
18import qualified Parse.Pattern as Pat (expr)
18import qualified Parse.Pattern as Pat (expr)
19import qualified Parse.Type as Type (expr)
19import qualified Parse.Type as Type (expr)
20−import Tests.Property.Arbitrary
20+import Test.Property.Arbitrary
21+
21
22
22propertyTests :: Test
23propertyTests :: Test
23propertyTests =
24propertyTests =
@@ -48,9 +49,20 @@ propertyTests =
48 , P.Var "su'BrrbPUK6I33Eq"
49 , P.Var "su'BrrbPUK6I33Eq"
49 ]
50 ]
50
51
52+
51prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
53prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
52−prop_parse_print p x =
54+prop_parse_print parser value =
53− either (const False) (== x) . parse_print p $ x
55+ either (const False) (== value) (parse_print parser value)
56+
54
57
55parse_print :: (Pretty a) => IParser a -> a -> Either String a
58parse_print :: (Pretty a) => IParser a -> a -> Either String a
59+parse_print parser value =
60+ let doc =
61+ pretty value
62+
63+ string =
56−parse_print p = either (Left . show) Right . iParse (p <* eof) . P.renderStyle P.style {mode=P.LeftMode} . pretty
64+ P.renderStyle P.style { mode = P.LeftMode } doc
65+ in
66+ case iParse (parser <* eof) string of
67+ Left msg -> Left (show msg)
68+ Right x -> Right x
tests/compiler/Tests/Property/Arbitrary.hs → tests/Test/Property/Arbitrary.hsrenamed+1−1
@@ -1,5 +1,5 @@
1{-# OPTIONS_GHC -W -fno-warn-orphans #-}
1{-# OPTIONS_GHC -W -fno-warn-orphans #-}
2−module Tests.Property.Arbitrary where
2+module Test.Property.Arbitrary where
3
3
4import Control.Applicative ((<$>), (<*>), pure)
4import Control.Applicative ((<$>), (<*>), pure)
5import Test.QuickCheck.Arbitrary
5import Test.QuickCheck.Arbitrary
tests/compiler/test-files/Imports.elm → tests/test-files/Imports.elmrenamed

The content is the same.

tests/compiler/test-files/bad/BBTArgs → tests/test-files/bad/BBTArgsrenamed

The content is the same.

tests/compiler/test-files/bad/Imports/UseHiddenValues.elm → tests/test-files/bad/Imports/UseHiddenValues.elmrenamed

The content is the same.

tests/compiler/test-files/bad/InfiniteType.elm → tests/test-files/bad/InfiniteType.elmrenamed

The content is the same.

tests/compiler/test-files/bad/NonElementMain.elm → tests/test-files/bad/NonElementMain.elmrenamed

The content is the same.

tests/compiler/test-files/bad/Strings/ExtraClose.elm → tests/test-files/bad/Strings/ExtraClose.elmrenamed

The content is the same.

tests/compiler/test-files/good/AliasSubstitution.elm → tests/test-files/good/AliasSubstitution.elmrenamed

The content is the same.

tests/compiler/test-files/good/NoExpressions.elm → tests/test-files/good/NoExpressions.elmrenamed

The content is the same.

tests/compiler/test-files/good/Otherwise.elm → tests/test-files/good/Otherwise.elmrenamed

The content is the same.

tests/compiler/test-files/good/Ports.elm → tests/test-files/good/Ports.elmrenamed

The content is the same.

tests/compiler/test-files/good/PortsWithTypeAliases.elm → tests/test-files/good/PortsWithTypeAliases.elmrenamed

The content is the same.

tests/compiler/test-files/good/QuotesAndComments.elm → tests/test-files/good/QuotesAndComments.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/Apply.elm → tests/test-files/good/Soundness/Apply.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/ApplyAnnotated.elm → tests/test-files/good/Soundness/ApplyAnnotated.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/Id.elm → tests/test-files/good/Soundness/Id.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/IdAnnotated.elm → tests/test-files/good/Soundness/IdAnnotated.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/TrickyId.elm → tests/test-files/good/Soundness/TrickyId.elmrenamed

The content is the same.

tests/compiler/test-files/good/Soundness/TrickyIdAnnotated.elm → tests/test-files/good/Soundness/TrickyIdAnnotated.elmrenamed

The content is the same.

tests/compiler/test-files/good/Strings/Multiline.elm → tests/test-files/good/Strings/Multiline.elmrenamed

The content is the same.

tests/compiler/test-files/good/Strings/MultilineNormal.elm → tests/test-files/good/Strings/MultilineNormal.elmrenamed

The content is the same.

tests/compiler/test-files/good/Unify/LockedVars.elm → tests/test-files/good/Unify/LockedVars.elmrenamed

The content is the same.

tests/compiler/test-files/good/Unify/NonHomogeneousRecords.elm → tests/test-files/good/Unify/NonHomogeneousRecords.elmrenamed

The content is the same.