on master help sign in
Get rid of testing stuff. Needs to be redone anyway for 0.19
commite2008b50e2c044a9586dcd9bbccf246aa11d07a9 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 21 Feb 2018, 17:48 (9 years ago) parent8f7c3cd
66 files changed−1069
.travis.yml−25 Setup.hs−2 tests/Test.hs−14 tests/Test/Compiler.hs−247 tests/Test/Property.hs−68 tests/Test/Property/Arbitrary.hs−193 tests/test-files/bad/BBTArgs−1 tests/test-files/bad/IncompletePatternMatch.elm−17 tests/test-files/bad/InfiniteType.elm−2 tests/test-files/bad/NonElementMain.elm−2 tests/test-files/bad/RepeatedArgument.elm−4 tests/test-files/bad/Strings/ExtraClose.elm−4 tests/test-files/good-expected-js/Cases/CharCase.elm.js−8 tests/test-files/good-expected-js/Cases/ListZip.elm.js−21 tests/test-files/good-expected-js/CodeGenBugs/CommentInterpretedAsInfix.elm.js−13 tests/test-files/good-expected-js/CodeGenBugs/NestedPatternMatch.elm.js−4 tests/test-files/good-expected-js/CodeGenBugs/Shadowing.elm.js−16 tests/test-files/good-expected-js/CodeGenBugs/Shadowing2.elm.js−13 tests/test-files/good-expected-js/CodeGenBugs/TailRecursion_ListAny.elm.js−20 tests/test-files/good-expected-js/Crash/CrashCase.elm.js−14 tests/test-files/good-expected-js/Crash/CrashIf.elm.js−8 tests/test-files/good-expected-js/Declarations/NoDefinitions.elm.js tests/test-files/good-expected-js/Lists/EmptyList.elm.js−1 tests/test-files/good-expected-js/Lists/NonEmptyList.elm.js−13 tests/test-files/good-expected-js/Literals/Multiline.elm.js−1 tests/test-files/good-expected-js/Literals/Negatives.elm.js−22 tests/test-files/good-expected-js/Literals/Numbers.elm.js−14 tests/test-files/good-expected-js/Literals/QuotesAndComments.elm.js−3 tests/test-files/good-expected-js/Records/Access.elm.js−19 tests/test-files/good-expected-js/Records/AliasSubstitution.elm.js−3 tests/test-files/good-expected-js/Records/NonHomogeneousRecords.elm.js−9 tests/test-files/good-expected-js/Soundness/Apply.elm.js−6 tests/test-files/good-expected-js/Soundness/ApplyAnnotated.elm.js−6 tests/test-files/good-expected-js/Soundness/Id.elm.js−6 tests/test-files/good-expected-js/Soundness/IdAnnotated.elm.js−6 tests/test-files/good-expected-js/Soundness/SpecificAnnotationInt.elm.js−3 tests/test-files/good-expected-js/Soundness/SpecificAnnotationNumber.elm.js−3 tests/test-files/good-expected-js/Soundness/TrickyId.elm.js−4 tests/test-files/good-expected-js/Soundness/TrickyIdAnnotated.elm.js−4 tests/test-files/good/Cases/CharCase.elm−8 tests/test-files/good/Cases/ListZip.elm−17 tests/test-files/good/CodeGenBugs/CommentInterpretedAsInfix.elm−12 tests/test-files/good/CodeGenBugs/NestedPatternMatch.elm−5 tests/test-files/good/CodeGenBugs/Shadowing.elm−22 tests/test-files/good/CodeGenBugs/Shadowing2.elm−25 tests/test-files/good/CodeGenBugs/TailRecursion_ListAny.elm−12 tests/test-files/good/Crash/CrashCase.elm−9 tests/test-files/good/Crash/CrashIf.elm−8 tests/test-files/good/Declarations/NoDefinitions.elm−3 tests/test-files/good/Lists/EmptyList.elm−2 tests/test-files/good/Lists/NonEmptyList.elm−2 tests/test-files/good/Literals/Multiline.elm−4 tests/test-files/good/Literals/Negatives.elm−17 tests/test-files/good/Literals/Numbers.elm−18 tests/test-files/good/Literals/QuotesAndComments.elm−10 tests/test-files/good/Records/Access.elm−22 tests/test-files/good/Records/AliasSubstitution.elm−13 tests/test-files/good/Records/NonHomogeneousRecords.elm−14 tests/test-files/good/Soundness/Apply.elm−3 tests/test-files/good/Soundness/ApplyAnnotated.elm−4 tests/test-files/good/Soundness/Id.elm−3 tests/test-files/good/Soundness/IdAnnotated.elm−4 tests/test-files/good/Soundness/SpecificAnnotationInt.elm−4 tests/test-files/good/Soundness/SpecificAnnotationNumber.elm−4 tests/test-files/good/Soundness/TrickyId.elm−2 tests/test-files/good/Soundness/TrickyIdAnnotated.elm−3
.travis.ymldeleted−25
@@ -1,25 +0,0 @@
1−sudo: false
2−
3−addons:
4− apt:
5− sources:
6− - hvr-ghc
7− packages:
8− - ghc-7.10.1
9− - cabal-install-1.22
10− - happy
11− - alex
12−
13−
14−before_install:
15−- export PATH=/opt/ghc/7.10.1/bin:/opt/cabal/1.22/bin:$PATH
16−
17−
18−install:
19− - travis_retry cabal update
20− - cabal install --only-dependencies --enable-tests
21−
22−
23−script:
24− - cabal configure --enable-tests
25− - cabal test
Setup.hsdeleted−2
@@ -1,2 +0,0 @@
1−import Distribution.Simple
2−main = defaultMain
tests/Test.hsdeleted−14
@@ -1,14 +0,0 @@
1−module Main where
2−
3−import Test.Framework
4−
5−import Test.Compiler
6−--import Test.Property
7−
8−
9−main :: IO ()
10−main =
11− defaultMain
12− [ compilerTests
13−-- , propertyTests
14− ]
tests/Test/Compiler.hsdeleted−247
@@ -1,247 +0,0 @@
1−{-# OPTIONS_GHC -W #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE ScopedTypeVariables #-}
4−module Test.Compiler (compilerTests) where
5−
6−import Control.Exception (try, IOException)
7−
8−import qualified Data.Text.Lazy as LText
9−import qualified Data.Text.Lazy.IO as LText
10−import qualified Data.Map as Map
11−import Data.Maybe (isJust)
12−import qualified Data.Text.IO as Text
13−import Data.Text (Text)
14−
15−import System.Directory (createDirectoryIfMissing)
16−import System.Environment (lookupEnv)
17−import System.FilePath ((</>), (<.>), dropFileName, joinPath, splitDirectories)
18−import System.FilePath.Find (find, (==?), extension)
19−
20−import Test.Framework
21−import Test.Framework.Providers.HUnit (testCase)
22−import Test.HUnit (Assertion, assertFailure, assertBool, assertEqual)
23−
24−import qualified Elm.Compiler as Compiler
25−import qualified Elm.Package as Package
26−import qualified AST.Module as Module
27−import qualified AST.Module.Name as ModuleName
28−import qualified AST.Variable as Variable
29−import qualified AST.Type as Type
30−
31−
32−
33−-- TESTS
34−
35−
36−writeExpectedJsEnvVarName :: String
37−writeExpectedJsEnvVarName =
38− "ELM_WRITE_NEW_EXPECTED"
39−
40−
41−compilerTests :: Test
42−compilerTests =
43− buildTest $
44− do goods <- testIf isSuccess =<< getElms "good"
45− bads <- testIf isFailure =<< getElms "bad"
46− expectedJsTests <- testMatchesExpected "good" "good-expected-js"
47− return $
48− testGroup "Compile Tests"
49− [ testGroup "Good Tests" goods
50− , testGroup "Bad Tests" bads
51− , testGroup "Expected JS Tests" expectedJsTests
52− ]
53−
54−
55−
56−-- GATHER FILES
57−
58−
59−getElms :: FilePath -> IO [FilePath]
60−getElms filePath =
61− find
62− (return True)
63− (extension ==? ".elm")
64− (testsDir </> filePath)
65−
66−
67−testsDir :: FilePath
68−testsDir =
69− "tests" </> "test-files"
70−
71−
72−convertToExpectedJsFilePath :: String -> FilePath -> FilePath
73−convertToExpectedJsFilePath expectedJsDir filePath =
74− testsDir
75− </> expectedJsDir
76− </> joinPath (drop 3 (splitDirectories filePath))
77− <.> ".js"
78−
79−
80−
81−-- COMPILE HELPERS
82−
83−
84−compile :: FilePath -> Text -> Either String Compiler.Result
85−compile filePath source =
86− let
87− context =
88− Compiler.Context Package.core False importDict interfaces
89−
90− (dealiaser, _warnings, result) =
91− Compiler.compile context source
92−
93− formatErrors errors =
94− concatMap (Compiler.errorToString dealiaser filePath source) errors
95− in
96− either (Left . formatErrors) Right result
97−
98−
99−importDict :: Map.Map ModuleName.Raw ModuleName.Canonical
100−importDict =
101− let
102− toPair name =
103− ( ModuleName._module name, name )
104− in
105− Map.fromList $ map toPair $ Map.keys interfaces
106−
107−
108−interfaces :: Module.Interfaces
109−interfaces =
110− Map.fromList
111− [
112− (ModuleName.inCore "Debug",
113− buildCoreInterface
114− [
115− ("crash", Type.Lambda (Type.Var "String") (Type.Var "a"))
116− ]
117− )
118− ]
119−
120−
121−buildCoreInterface :: [(Text, Type.Canonical)] -> Module.Interface
122−buildCoreInterface members =
123− let
124− exports = map (Variable.Value . fst) members
125− imports = []
126− types = Map.fromList members
127− adts = Map.empty
128− aliases = Map.empty
129− fixities = []
130− in
131− Module.Interface Compiler.version Package.core exports imports types adts aliases fixities
132−
133−
134−
135−-- FILE HELPER
136−
137−
138−readFileOrErrorStr :: FilePath -> IO String
139−readFileOrErrorStr filePath =
140− do strOrExc <- try $ readFile filePath
141− case strOrExc of
142− Right s ->
143− return s
144−
145− Left (e :: IOException) ->
146− return (show e)
147−
148−
149−
150−-- RUN TESTS
151−
152−
153−testIf
154− :: (Either String Compiler.Result -> Assertion)
155− -> [FilePath]
156− -> IO [Test]
157−testIf handleResult filePaths =
158− let doTest filePath =
159− do source <- Text.readFile filePath
160− let formattedResult = compile filePath source
161− return $ testCase filePath (handleResult formattedResult)
162− in
163− traverse doTest filePaths
164−
165−
166−doMatchesExpectedTest :: String -> FilePath -> IO Test
167−doMatchesExpectedTest expectedJsDir filePath =
168− do source <- Text.readFile filePath
169− expectedJs <- readFileOrErrorStr (convertToExpectedJsFilePath expectedJsDir filePath)
170−
171− let formattedResult = compile filePath source
172− let assertion = matchesExpected expectedJs formattedResult
173−
174− return $ testCase filePath assertion
175−
176−
177−doWriteNewExpectedTest :: String -> FilePath -> IO Test
178−doWriteNewExpectedTest expectedJsDir filePath =
179− do source <- Text.readFile filePath
180− let formattedResult = compile filePath source
181− let expectedFilePath = convertToExpectedJsFilePath expectedJsDir filePath
182− let assertion =
183− case formattedResult of
184− Right (Compiler.Result _ _ js) ->
185− do createDirectoryIfMissing True (dropFileName expectedFilePath)
186− -- Force the evaluation of `js` before `writeFile`
187− -- so that if an error is raised we do not unintentionally write an empty file.
188− -- NB: `js` can be an empty string in the case of NoExpressions.elm
189− assertBool "" (LText.length js >= 0)
190− LText.writeFile expectedFilePath js
191− assertFailure ("Wrote new expected js: " ++ expectedFilePath)
192−
193− _ ->
194− assertFailure "Compile failed. Could not write new expected js."
195− return $ testCase filePath assertion
196−
197−
198−testMatchesExpected :: String -> String -> IO [Test]
199−testMatchesExpected elmDir expectedJsDir =
200− do elmFiles <- getElms elmDir
201− envVar <- lookupEnv writeExpectedJsEnvVarName
202− if isJust envVar
203− then
204− traverse (doWriteNewExpectedTest expectedJsDir) elmFiles
205− else
206− traverse (doMatchesExpectedTest expectedJsDir) elmFiles
207−
208−
209−
210−-- CHECK RESULTS
211−
212−
213−isSuccess :: Either String a -> Assertion
214−isSuccess result =
215− case result of
216− Right _ ->
217− assertBool "" True
218−
219− Left errorMessages ->
220− assertFailure errorMessages
221−
222−
223−isFailure :: Either a b -> Assertion
224−isFailure result =
225− case result of
226− Right _ ->
227− assertFailure "Compilation succeeded but should have failed"
228−
229− Left _ ->
230− assertBool "" True
231−
232−
233−matchesExpected :: String -> Either String Compiler.Result -> Assertion
234−matchesExpected expectedJs result =
235− case result of
236− Right (Compiler.Result _ _ js) ->
237− assertEqual matchFailureMessage (LText.pack expectedJs) js
238−
239− Left errorMessages ->
240− assertFailure $ "Compile failed:\n" ++ errorMessages
241−
242−
243−matchFailureMessage :: String
244−matchFailureMessage =
245− "Compiled JS did not match expected JS." ++
246− "\n If the change is intentional, rerun " ++
247− "the tests with environment variable: " ++ writeExpectedJsEnvVarName ++ "=1"
tests/Test/Property.hsdeleted−68
@@ -1,68 +0,0 @@
1−module Test.Property where
2−
3−import Control.Applicative ((<*))
4−import Test.Framework
5−import Test.Framework.Providers.HUnit
6−import Test.Framework.Providers.QuickCheck2
7−import Test.HUnit (assert)
8−import Test.QuickCheck
9−import Text.Parsec.Combinator (eof)
10−import Text.PrettyPrint as P
11−
12−import AST.Literal as Lit
13−import qualified AST.Pattern as P
14−import qualified AST.Variable as V
15−import Reporting.PrettyPrint (Pretty, pretty)
16−import Parse.Helpers (IParser, iParse)
17−import Parse.Literal (literal)
18−import qualified Parse.Pattern as Pat (expr)
19−import qualified Parse.Type as Type (expr)
20−import Test.Property.Arbitrary
21−
22−
23−propertyTests :: Test
24−propertyTests =
25− testGroup "Parse/Print Agreement Tests"
26− [ testCase "Long Pattern test" $ assert (prop_parse_print Pat.expr longPat)
27− , testProperty "Literal test" $ prop_parse_print literal
28− , testProperty "Pattern test" $ prop_parse_print Pat.expr
29− , testProperty "Type test" $ prop_parse_print Type.expr
30− ]
31−
32− where
33− -- This test was autogenerated from the Pattern test and should be
34− -- left in all its ugly glory.
35− longPat = P.Data (V.Raw "I")
36− [ P.Literal (Lit.Chr '+')
37− , P.Record
38− [ "q7yclkcm7k_ikstrczv_"
39− , "wQRv6gKsvvkjw4b5F"
40− ,"c9'eFfhk9FTvsMnwF_D"
41− ,"yqxhEkHvRFwZ"
42− ,"o"
43− ,"nbUlCn3y3NnkVoxhW"
44− ,"iJ0MNy3KZ_lrs"
45− ,"ug"
46− ,"sHHsX"
47− ,"mRKs9d"
48− ,"o2KiCX5'ZRzHJfRi8" ]
49− , P.Var "su'BrrbPUK6I33Eq"
50− ]
51−
52−
53−prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
54−prop_parse_print parser value =
55− either (const False) (== value) (parse_print parser value)
56−
57−
58−parse_print :: (Pretty a) => IParser a -> a -> Either String a
59−parse_print parser value =
60− let doc =
61− pretty value
62−
63− string =
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/Test/Property/Arbitrary.hsdeleted−193
@@ -1,193 +0,0 @@
1−{-# OPTIONS_GHC -W -fno-warn-orphans #-}
2−module Test.Property.Arbitrary where
3−
4−import Control.Applicative ((<$>), (<*>), pure)
5−import Test.QuickCheck.Arbitrary
6−import Test.QuickCheck.Gen
7−
8−import qualified Data.Set as Set
9−import qualified Parse.Helpers (reserveds)
10−
11−import qualified AST.Literal as L
12−import qualified AST.Pattern as P
13−import qualified AST.Type as T
14−import qualified AST.Variable as V
15−
16−
17−instance Arbitrary V.Raw where
18− arbitrary =
19− V.Raw <$> capVar
20−
21− shrink (V.Raw v) =
22− V.Raw <$> shrink v
23−
24−
25−instance Arbitrary L.Literal where
26− arbitrary =
27− oneof
28− [ L.IntNum <$> arbitrary
29− , L.FloatNum <$> (arbitrary `suchThat` noE)
30− , L.Chr <$> arbitrary
31− -- This is too permissive
32− , L.Str <$> arbitrary
33− -- Booleans aren't actually source syntax
34− -- , Boolean <$> arbitrary
35− ]
36−
37− shrink literal =
38− case literal of
39− L.IntNum int ->
40− L.IntNum <$> shrink int
41−
42− L.FloatNum float ->
43− L.FloatNum <$> filter noE (shrink float)
44−
45− L.Chr char ->
46− L.Chr <$> shrink char
47−
48− L.Str string ->
49− L.Str <$> shrink string
50−
51− L.Boolean bool ->
52− L.Boolean <$> shrink bool
53−
54−
55−noE :: Double -> Bool
56−noE =
57− notElem 'e' . show
58−
59−
60−genVector :: Int -> (Int -> Gen a) -> Gen [a]
61−genVector n generator =
62− do len <- choose (0,n)
63− let m = n `div` (len + 1)
64− vectorOf len $ generator m
65−
66−instance Arbitrary v => Arbitrary (P.Pattern v) where
67− arbitrary =
68− sized pattern
69− where
70− pattern :: (Arbitrary v) => Int -> Gen (P.Pattern v)
71− pattern n =
72− oneof
73− [ pure P.Anything
74− , P.Var <$> lowVar
75− , P.Record <$> (listOf1 lowVar)
76− , P.Literal <$> arbitrary
77− , P.Alias <$> lowVar <*> pattern (n-1)
78− , P.Data <$> arbitrary <*> genVector n pattern
79− ]
80−
81− shrink pattern =
82− case pattern of
83− P.Anything ->
84− []
85−
86− P.Var var ->
87− P.Var <$> consAndShrink var
88−
89− P.Literal literal ->
90− P.Literal <$> shrink literal
91−
92− P.Alias alias pattern ->
93− pattern : (P.Alias <$> consAndShrink alias <*> shrink pattern)
94−
95− P.Data name patterns ->
96− patterns ++ (P.Data <$> shrink name <*> shrink patterns)
97−
98− P.Record fields ->
99− P.Record <$> filter (all notNull) (filter notNull (shrink fields))
100− where
101− notNull = not . null
102−
103−
104−consAndShrink :: Arbitrary a => [a] -> [[a]]
105−consAndShrink values =
106− case values of
107− [] -> error "Should be nonempty"
108− x:xs -> (x:) <$> shrink xs
109−
110−
111−instance Arbitrary v => Arbitrary (T.Type v) where
112− arbitrary =
113− sized tipe
114− where
115− tipe :: Arbitrary v => Int -> Gen (T.Type v)
116− tipe n =
117− let depthTipe = tipe =<< choose (0,n)
118− field = (,) <$> lowVar <*> depthTipe
119− fields = genVector n (\m -> (,) <$> lowVar <*> tipe m)
120− fields1 = (:) <$> field <*> fields
121− depthTipes = (:) <$> depthTipe <*> genVector n tipe
122− in
123− oneof
124− [ T.Lambda <$> depthTipe <*> depthTipe
125− , T.Var <$> lowVar
126− , T.Type <$> arbitrary
127− , T.App <$> (T.Type <$> arbitrary) <*> depthTipes
128− , T.Record <$> fields <*> pure Nothing
129− , T.Record <$> fields1 <*> (Just . T.Var <$> lowVar)
130− ]
131−
132− shrink tipe =
133− case tipe of
134− T.Lambda arg result ->
135− arg : result : (T.Lambda <$> shrink arg <*> shrink result)
136−
137− T.Var _ ->
138− []
139−
140− T.Aliased name tvars rootType ->
141− rootType : (T.Aliased name <$> shrinkList shrinkPair tvars <*> shrink rootType)
142−
143− T.Type name ->
144− T.Type <$> shrink name
145−
146− T.App func args ->
147− func : args ++ (T.App <$> shrink func <*> shrink args)
148−
149− T.Record fields extension ->
150− map snd fields ++ record
151− where
152− record =
153− case extension of
154− Nothing ->
155− T.Record <$> shrinkList shrinkPair fields <*> pure Nothing
156−
157− Just _ ->
158− do fields' <- filter (not . null) $ shrinkList shrinkPair fields
159− return $ T.Record fields' extension
160− where
161− shrinkPair (name, tipe) =
162− (,) <$> consAndShrink name <*> shrink tipe
163−
164−
165−lowVar :: Gen String
166−lowVar =
167− notReserved $
168− (:) <$> elements ['a'..'z'] <*> listOf varLetter
169−
170−
171−capVar :: Gen String
172−capVar =
173− notReserved $
174− (:) <$> elements ['A'..'Z'] <*> listOf varLetter
175−
176−
177−varLetter :: Gen Char
178−varLetter =
179− elements $ ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ ['\'', '_']
180−
181−
182−notReserved :: Gen String -> Gen String
183−notReserved string =
184− string `exceptFor` Parse.Helpers.reserveds
185−
186−
187−exceptFor :: Gen a -> Set.Set a -> Gen a
188−exceptFor generator set =
189− let
190− notInList x =
191− Set.notMember x set
192− in
193− generator `suchThat` notInList
tests/test-files/bad/BBTArgsdeleted−1
@@ -1 +0,0 @@
1−Fail
tests/test-files/bad/IncompletePatternMatch.elmdeleted−17
@@ -1,17 +0,0 @@
1−
2−type List a
3− = Nil
4− | Cons a (List a)
5−
6−
7−zip : List a -> List b -> List (a, b)
8−zip list1 list2 =
9− case (list1, list2) of
10− (Nil, _) ->
11− Nil
12−
13− (Cons x xs, Cons y ys) ->
14− Cons (x, y) (zip xs ys)
15−
16− -- incomplete pattern match is an error
17− -- missing: (_, Nil) -> Nil
tests/test-files/bad/InfiniteType.elmdeleted−2
@@ -1,2 +0,0 @@
1−
2−f = f 42
tests/test-files/bad/NonElementMain.elmdeleted−2
@@ -1,2 +0,0 @@
1−
2−main = 42
tests/test-files/bad/RepeatedArgument.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−foo x x = 42
3−
4−bar x (x, y) = 42
tests/test-files/bad/Strings/ExtraClose.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−s = " " "
3−
4−main = plainText s
tests/test-files/good-expected-js/Cases/CharCase.elm.jsdeleted−8
@@ -1,8 +0,0 @@
1−var _elm_lang$core$Main$foo = function (x) {
2− var _p0 = x;
3− if (_p0.valueOf() === 'A') {
4− return 'hello';
5− } else {
6− return 'letter A was not seen';
7− }
8−};
tests/test-files/good-expected-js/Cases/ListZip.elm.jsdeleted−21
@@ -1,21 +0,0 @@
1−var _elm_lang$core$Main$Cons = F2(
2− function (v1, v2) {
3− return {ctor: 'Cons', _0: v1, _1: v2};
4− });
5−var _elm_lang$core$Main$Nil = {ctor: 'Nil'};
6−var _elm_lang$core$Main$zip = F2(
7− function (list1, list2) {
8− var _p0 = {ctor: '_Tuple2', _0: list1, _1: list2};
9− if (_p0._0.ctor === 'Nil') {
10− return _elm_lang$core$Main$Nil;
11− } else {
12− if (_p0._1.ctor === 'Nil') {
13− return _elm_lang$core$Main$Nil;
14− } else {
15− return A2(
16− _elm_lang$core$Main$Cons,
17− {ctor: '_Tuple2', _0: _p0._0._0, _1: _p0._1._0},
18− A2(_elm_lang$core$Main$zip, _p0._0._1, _p0._1._1));
19− }
20− }
21− });
tests/test-files/good-expected-js/CodeGenBugs/CommentInterpretedAsInfix.elm.jsdeleted−13
@@ -1,13 +0,0 @@
1−var _elm_lang$core$Main$always = F2(
2− function (x, s) {
3− return x;
4− });
5−var _elm_lang$core$Main_ops = _elm_lang$core$Main_ops || {};
6−_elm_lang$core$Main_ops['|>'] = F2(
7− function (a, f) {
8− return f(a);
9− });
10−var _elm_lang$core$Main$value = A2(
11− _elm_lang$core$Main_ops['|>'],
12− 'Hi',
13− _elm_lang$core$Main$always('Hello'));
tests/test-files/good-expected-js/CodeGenBugs/NestedPatternMatch.elm.jsdeleted−4
@@ -1,4 +0,0 @@
1−var _elm_lang$core$Main$foo = function (_p0) {
2− var _p1 = _p0;
3− return _p1;
4−};
tests/test-files/good-expected-js/CodeGenBugs/Shadowing.elm.jsdeleted−16
@@ -1,16 +0,0 @@
1−var _elm_lang$core$Main$toName = function (a) {
2− var name = function () {
3− var _p0 = a;
4− if (_p0.ctor === 'First') {
5− return 'True';
6− } else {
7− return _p0._0;
8− }
9− }();
10− return name;
11−};
12−var _elm_lang$core$Main$Second = F2(
13− function (v1, v2) {
14− return {ctor: 'Second', _0: v1, _1: v2};
15− });
16−var _elm_lang$core$Main$First = {ctor: 'First'};
tests/test-files/good-expected-js/CodeGenBugs/Shadowing2.elm.jsdeleted−13
@@ -1,13 +0,0 @@
1−var _elm_lang$core$Main$Nothing = {ctor: 'Nothing'};
2−var _elm_lang$core$Main$Just = function (v1) {
3− return {ctor: 'Just', _0: v1};
4−};
5−var _elm_lang$core$Main$withDefault0 = function (maybe) {
6− var _p0 = maybe;
7− if (_p0.ctor === 'Just') {
8− var maybe = _elm_lang$core$Main$Just('shadow argument, but do not overwrite it in JS!');
9− return _p0._0;
10− } else {
11− return 0;
12− }
13−};
tests/test-files/good-expected-js/CodeGenBugs/TailRecursion_ListAny.elm.jsdeleted−20
@@ -1,20 +0,0 @@
1−var _elm_lang$core$Main$any = F2(
2− function (isOk, list) {
3− any:
4− while (true) {
5− var _p0 = list;
6− if (_p0.ctor === '::') {
7− if (isOk(_p0._0)) {
8− return true;
9− } else {
10− var _v1 = isOk,
11− _v2 = _p0._1;
12− isOk = _v1;
13− list = _v2;
14− continue any;
15− }
16− } else {
17− return false;
18− }
19− }
20− });
tests/test-files/good-expected-js/Crash/CrashCase.elm.jsdeleted−14
@@ -1,14 +0,0 @@
1−var _elm_lang$core$Main$test = function (x) {
2− var _p0 = x;
3− if (_p0 === 1) {
4− return 2;
5− } else {
6− return _elm_lang$core$Native_Utils.crashCase(
7− 'Main',
8− {
9− start: {line: 5, column: 5},
10− end: {line: 9, column: 43}
11− },
12− _p0)('unexpected value');
13− }
14−};
tests/test-files/good-expected-js/Crash/CrashIf.elm.jsdeleted−8
@@ -1,8 +0,0 @@
1−var _elm_lang$core$Main$test = function (x) {
2− return x ? 2 : _elm_lang$core$Native_Utils.crash(
3− 'Main',
4− {
5− start: {line: 8, column: 9},
6− end: {line: 8, column: 20}
7− })('unexpected value');
8−};
tests/test-files/good-expected-js/Declarations/NoDefinitions.elm.jsdeleted

No changes to the content.

tests/test-files/good-expected-js/Lists/EmptyList.elm.jsdeleted−1
@@ -1 +0,0 @@
1−var _elm_lang$core$Main$emptyList = {ctor: '[]'};
tests/test-files/good-expected-js/Lists/NonEmptyList.elm.jsdeleted−13
@@ -1,13 +0,0 @@
1−var _elm_lang$core$Main$nonEmptyList = {
2− ctor: '::',
3− _0: 1,
4− _1: {
5− ctor: '::',
6− _0: 4,
7− _1: {
8− ctor: '::',
9− _0: 5,
10− _1: {ctor: '[]'}
11− }
12− }
13−};
tests/test-files/good-expected-js/Literals/Multiline.elm.jsdeleted−1
@@ -1 +0,0 @@
1−var _elm_lang$core$Main$s = '\nhere\'s a quote: "\n\n';
tests/test-files/good-expected-js/Literals/Negatives.elm.jsdeleted−22
@@ -1,22 +0,0 @@
1−var _elm_lang$core$Main_ops = _elm_lang$core$Main_ops || {};
2−_elm_lang$core$Main_ops['-'] = F2(
3− function (x, y) {
4− return x;
5− });
6−var _elm_lang$core$Main$minus = A2(_elm_lang$core$Main_ops['-'], 3, 4);
7−var _elm_lang$core$Main$minusNegative = A2(
8− _elm_lang$core$Main_ops['-'],
9− 3,
10− A2(_elm_lang$core$Main_ops['-'], 0, 4));
11−var _elm_lang$core$Main$negativeMinusNegative = A2(
12− _elm_lang$core$Main_ops['-'],
13− A2(_elm_lang$core$Main_ops['-'], 0, 3),
14− A2(_elm_lang$core$Main_ops['-'], 0, 4));
15−var _elm_lang$core$Main$negativeInParens = A2(_elm_lang$core$Main_ops['-'], 0, 2);
16−var _elm_lang$core$Main$funcMinus = A2(
17− F2(
18− function (x, y) {
19− return A2(_elm_lang$core$Main_ops['-'], x, y);
20− }),
21− 3,
22− 4);
tests/test-files/good-expected-js/Literals/Numbers.elm.jsdeleted−14
@@ -1,14 +0,0 @@
1−var _elm_lang$core$Main$hex5 = 1193865;
2−var _elm_lang$core$Main$hex4 = 48879;
3−var _elm_lang$core$Main$hex3 = 48879;
4−var _elm_lang$core$Main$hex2 = 64;
5−var _elm_lang$core$Main$hex1 = 4294967295;
6−var _elm_lang$core$Main$float4 = 2300.0;
7−var _elm_lang$core$Main$float3 = 6.022e26;
8−var _elm_lang$core$Main$float2 = 0.67;
9−var _elm_lang$core$Main$float1 = 3.14;
10−var _elm_lang$core$Main$exp4 = 1000.0;
11−var _elm_lang$core$Main$exp3 = 2.0e-9;
12−var _elm_lang$core$Main$exp2 = 3.0e7;
13−var _elm_lang$core$Main$exp1 = 4.0e9;
14−var _elm_lang$core$Main$int = 12345;
tests/test-files/good-expected-js/Literals/QuotesAndComments.elm.jsdeleted−3
@@ -1,3 +0,0 @@
1−var _elm_lang$core$Main$commentStart = '{-';
2−var _elm_lang$core$Main$singleQuote = _elm_lang$core$Native_Utils.chr('\'');
3−var _elm_lang$core$Main$doubleQuote = _elm_lang$core$Native_Utils.chr('\"');
tests/test-files/good-expected-js/Records/Access.elm.jsdeleted−19
@@ -1,19 +0,0 @@
1−var _elm_lang$core$Main$apply = F2(
2− function (f, x) {
3− return f(x);
4− });
5−var _elm_lang$core$Main$point = {x: 3, y: 4};
6−var _elm_lang$core$Main$x1 = _elm_lang$core$Main$point.x;
7−var _elm_lang$core$Main$x2 = function (r) {
8− return r.x;
9−}(_elm_lang$core$Main$point);
10−var _elm_lang$core$Main$x3 = _elm_lang$core$Main$point.x;
11−var _elm_lang$core$Main$x4 = function (r) {
12− return r.x;
13−}(_elm_lang$core$Main$point);
14−var _elm_lang$core$Main$x5 = A2(
15− _elm_lang$core$Main$apply,
16− function (r) {
17− return r.x;
18− },
19− _elm_lang$core$Main$point);
tests/test-files/good-expected-js/Records/AliasSubstitution.elm.jsdeleted−3
@@ -1,3 +0,0 @@
1−var _elm_lang$core$Main$extractVec = function (v) {
2− return {x: v.x, y: v.y};
3−};
tests/test-files/good-expected-js/Records/NonHomogeneousRecords.elm.jsdeleted−9
@@ -1,9 +0,0 @@
1−var _elm_lang$core$Main$bindFields = function (thing) {
2− var y = thing.y;
3− var x = thing.x;
4− return thing;
5−};
6−var _elm_lang$core$Main$Thing = F2(
7− function (v1, v2) {
8− return {x: v1, y: v2};
9− });
tests/test-files/good-expected-js/Soundness/Apply.elm.jsdeleted−6
@@ -1,6 +0,0 @@
1−var _elm_lang$core$Main$apply = function (f) {
2− var g = function (x) {
3− return f(x);
4− };
5− return g;
6−};
tests/test-files/good-expected-js/Soundness/ApplyAnnotated.elm.jsdeleted−6
@@ -1,6 +0,0 @@
1−var _elm_lang$core$Main$apply = function (f) {
2− var g = function (x) {
3− return f(x);
4− };
5− return g;
6−};
tests/test-files/good-expected-js/Soundness/Id.elm.jsdeleted−6
@@ -1,6 +0,0 @@
1−var _elm_lang$core$Main$myId = function () {
2− var id = function (x) {
3− return x;
4− };
5− return id;
6−}();
tests/test-files/good-expected-js/Soundness/IdAnnotated.elm.jsdeleted−6
@@ -1,6 +0,0 @@
1−var _elm_lang$core$Main$myId = function () {
2− var id = function (x) {
3− return x;
4− };
5− return id;
6−}();
tests/test-files/good-expected-js/Soundness/SpecificAnnotationInt.elm.jsdeleted−3
@@ -1,3 +0,0 @@
1−var _elm_lang$core$Main$px = function (x) {
2− return 'test';
3−};
tests/test-files/good-expected-js/Soundness/SpecificAnnotationNumber.elm.jsdeleted−3
@@ -1,3 +0,0 @@
1−var _elm_lang$core$Main$px = function (x) {
2− return 'test';
3−};
tests/test-files/good-expected-js/Soundness/TrickyId.elm.jsdeleted−4
@@ -1,4 +0,0 @@
1−var _elm_lang$core$Main$myId = function (x) {
2− var y = x;
3− return y;
4−};
tests/test-files/good-expected-js/Soundness/TrickyIdAnnotated.elm.jsdeleted−4
@@ -1,4 +0,0 @@
1−var _elm_lang$core$Main$myId = function (x) {
2− var y = x;
3− return y;
4−};
tests/test-files/good/Cases/CharCase.elmdeleted−8
@@ -1,8 +0,0 @@
1−
2−foo x =
3− case x of
4− 'A' ->
5− "hello"
6−
7− _ ->
8− "letter A was not seen"
tests/test-files/good/Cases/ListZip.elmdeleted−17
@@ -1,17 +0,0 @@
1−
2−type List a
3− = Nil
4− | Cons a (List a)
5−
6−
7−zip : List a -> List b -> List (a, b)
8−zip list1 list2 =
9− case (list1, list2) of
10− (Nil, _) ->
11− Nil
12−
13− (_, Nil) ->
14− Nil
15−
16− (Cons x xs, Cons y ys) ->
17− Cons (x, y) (zip xs ys)
tests/test-files/good/CodeGenBugs/CommentInterpretedAsInfix.elmdeleted−12
@@ -1,12 +0,0 @@
1−
2−-- Issue: https://github.com/elm-lang/elm-compiler/issues/894
3−-- Two dashes immediately follow by other symbols are incorrectly
4−-- interpreted as an infix operator, instead of a comment.
5−
6−(|>) a f = f a
7−
8−always x s = x
9−
10−value = "Hi"
11− |> always "Hello"
12− --|> always "Bye"
tests/test-files/good/CodeGenBugs/NestedPatternMatch.elmdeleted−5
@@ -1,5 +0,0 @@
1−
2−-- Issue: https://github.com/elm-lang/elm-compiler/issues/1115
3−-- Nested patterns are not correctly handled and fail with unreachable assertion error.
4−
5−foo (({f1} as r1) as r2) = r1
tests/test-files/good/CodeGenBugs/Shadowing.elmdeleted−22
@@ -1,22 +0,0 @@
1−-- From: https://github.com/elm-lang/elm-compiler/issues/1086
2−--
3−-- Problem is that the `a` in (Second a b) shadowed the argument to `toName`,
4−-- actually overwriting the value.
5−
6−
7−type AType
8− = First
9− | Second String String
10−
11−
12−toName : AType -> String
13−toName a =
14− let name =
15− case a of
16− First ->
17− "True"
18−
19− Second a b ->
20− a
21− in
22− name
tests/test-files/good/CodeGenBugs/Shadowing2.elmdeleted−25
@@ -1,25 +0,0 @@
1−-- https://github.com/elm-lang/elm-compiler/issues/1090
2−--
3−-- The problem was shadowing a variable used in a pattern match, but then
4−-- rebinding the variable before using all the subparts. There was an issue
5−-- in which inlining of certain values let names jump into scopes where they
6−-- did not belong.
7−
8−
9−type Maybe a
10− = Just a
11− | Nothing
12−
13−
14−withDefault0 : Maybe Int -> Int
15−withDefault0 maybe =
16− case maybe of
17− Just int ->
18− let
19− maybe =
20− Just "shadow argument, but do not overwrite it in JS!"
21− in
22− int -- should be from the `maybe` in the argument, not the shadow
23−
24− _ ->
25− 0
tests/test-files/good/CodeGenBugs/TailRecursion_ListAny.elmdeleted−12
@@ -1,12 +0,0 @@
1−
2−any isOk list =
3− case list of
4− first :: rest ->
5− if isOk first then
6− True
7−
8− else
9− any isOk rest
10−
11− _ ->
12− False
tests/test-files/good/Crash/CrashCase.elmdeleted−9
@@ -1,9 +0,0 @@
1−
2−import Debug
3−
4−test x =
5− case x of
6− 1 ->
7− 2
8− _ ->
9− Debug.crash "unexpected value"
tests/test-files/good/Crash/CrashIf.elmdeleted−8
@@ -1,8 +0,0 @@
1−
2−import Debug
3−
4−test x =
5− if x then
6− 2
7− else
8− Debug.crash "unexpected value"
tests/test-files/good/Declarations/NoDefinitions.elmdeleted−3
@@ -1,3 +0,0 @@
1−
2−type alias Width = Float
3−type alias Height = Float
tests/test-files/good/Lists/EmptyList.elmdeleted−2
@@ -1,2 +0,0 @@
1−
2−emptyList = []
tests/test-files/good/Lists/NonEmptyList.elmdeleted−2
@@ -1,2 +0,0 @@
1−
2−nonEmptyList = [1,4,5]
tests/test-files/good/Literals/Multiline.elmdeleted−4
@@ -1,4 +0,0 @@
1−s = """
2−here's a quote: "
3−
4−"""
tests/test-files/good/Literals/Negatives.elmdeleted−17
@@ -1,17 +0,0 @@
1−
2−(-) x y = x
3−
4−minus =
5− 3 - 4
6−
7−minusNegative =
8− 3 - -4
9−
10−negativeMinusNegative =
11− -3 - -4
12−
13−negativeInParens =
14− (-2)
15−
16−funcMinus =
17− (-) 3 4
tests/test-files/good/Literals/Numbers.elmdeleted−18
@@ -1,18 +0,0 @@
1−
2−int = 12345
3−
4−exp1 = 4e9
5−exp2 = 3E7
6−exp3 = 2e-9
7−exp4 = 1E+3
8−
9−float1 = 3.14
10−float2 = 0.67
11−float3 = 6.022e26
12−float4 = 0.23E4
13−
14−hex1 = 0xFFFFFFFF
15−hex2 = 0x0040
16−hex3 = 0xbeef
17−hex4 = 0xBEEF
18−hex5 = 0x0123789
tests/test-files/good/Literals/QuotesAndComments.elmdeleted−10
@@ -1,10 +0,0 @@
1−
2−
3−doubleQuote = '\"'
4−
5−
6−singleQuote = '\''
7−
8−
9−{- this is an {- embeded comment -} -}
10−commentStart = "{-"
tests/test-files/good/Records/Access.elmdeleted−22
@@ -1,22 +0,0 @@
1−
2−point =
3− { x = 3, y = 4 }
4−
5−x1 =
6− point.x
7−
8−x2 =
9− .x point
10−
11−x3 =
12− (point).x
13−
14−x4 =
15− (.x) point
16−
17−
18−apply f x = f x
19−
20−x5 =
21− apply .x point
22−
tests/test-files/good/Records/AliasSubstitution.elmdeleted−13
@@ -1,13 +0,0 @@
1−
2−
3−type alias Vec2Ext record =
4− { record | x:Float, y:Float }
5−
6−
7−type alias Vec2 =
8− Vec2Ext {}
9−
10−
11−extractVec : Vec2Ext a -> Vec2
12−extractVec v =
13− { x = v.x, y = v.y }
tests/test-files/good/Records/NonHomogeneousRecords.elmdeleted−14
@@ -1,14 +0,0 @@
1−
2−type alias Thing =
3− { x : Float
4− , y : Float
5− }
6−
7−
8−bindFields : Thing -> Thing
9−bindFields thing =
10− let
11− x = thing.x
12− y = thing.y
13− in
14− thing
tests/test-files/good/Soundness/Apply.elmdeleted−3
@@ -1,3 +0,0 @@
1−
2−apply f = let g x = f x
3− in g
tests/test-files/good/Soundness/ApplyAnnotated.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−apply : (a -> b) -> a -> b
3−apply f = let g x = f x
4− in g
tests/test-files/good/Soundness/Id.elmdeleted−3
@@ -1,3 +0,0 @@
1−
2−myId =
3− let id x = x in id
tests/test-files/good/Soundness/IdAnnotated.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−myId = let id : a -> a
3− id x = x
4− in id
tests/test-files/good/Soundness/SpecificAnnotationInt.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−px : Int -> String
3−px x =
4− "test"
tests/test-files/good/Soundness/SpecificAnnotationNumber.elmdeleted−4
@@ -1,4 +0,0 @@
1−
2−px : number -> String
3−px x =
4− "test"
tests/test-files/good/Soundness/TrickyId.elmdeleted−2
@@ -1,2 +0,0 @@
1−
2−myId x = let y = x in y
tests/test-files/good/Soundness/TrickyIdAnnotated.elmdeleted−3
@@ -1,3 +0,0 @@
1−
2−myId : a -> a
3−myId x = let y = x in y