Skip to content
This repository was archived by the owner on Oct 5, 2024. It is now read-only.

Commit 495b5ae

Browse files
committed
Add failing tests :(
1 parent a4ea660 commit 495b5ae

File tree

1 file changed

+57
-5
lines changed

1 file changed

+57
-5
lines changed

tests/ParserTest.elm

+57-5
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ expr =
501501
x + 1
502502
"""
503503
|> String.unindent
504+
|> String.removeNewlinesAtEnds
504505
, Just
505506
(Lambda
506507
{ arguments = [ "x" ]
@@ -573,6 +574,7 @@ expr =
573574
arg2
574575
"""
575576
|> String.unindent
577+
|> String.removeNewlinesAtEnds
576578
, Just
577579
(Call
578580
{ fn =
@@ -617,6 +619,7 @@ expr =
617619
618620
"""
619621
|> String.unindent
622+
|> String.removeNewlinesAtEnds
620623
, Just
621624
(If
622625
{ test = Int 1
@@ -938,6 +941,7 @@ expr =
938941
2
939942
"""
940943
|> String.unindent
944+
|> String.removeNewlinesAtEnds
941945
, Just
942946
(Let
943947
{ bindings =
@@ -957,6 +961,7 @@ expr =
957961
2
958962
"""
959963
|> String.unindent
964+
|> String.removeNewlinesAtEnds
960965
, Nothing
961966
)
962967
, ( "allows result expr on the same indentation level as `let`"
@@ -967,6 +972,7 @@ expr =
967972
2
968973
"""
969974
|> String.unindent
975+
|> String.removeNewlinesAtEnds
970976
, Just
971977
(Let
972978
{ bindings =
@@ -987,6 +993,7 @@ expr =
987993
3
988994
"""
989995
|> String.unindent
996+
|> String.removeNewlinesAtEnds
990997
, Just
991998
(Let
992999
{ bindings =
@@ -1010,6 +1017,7 @@ expr =
10101017
3
10111018
"""
10121019
|> String.unindent
1020+
|> String.removeNewlinesAtEnds
10131021
, Nothing
10141022
)
10151023
, ( "doesn't allow bindings to have different indentation from each other - the other way"
@@ -1021,6 +1029,7 @@ expr =
10211029
3
10221030
"""
10231031
|> String.unindent
1032+
|> String.removeNewlinesAtEnds
10241033
, Nothing
10251034
)
10261035
, ( "one binding that's used in the body"
@@ -1031,6 +1040,7 @@ expr =
10311040
1 + x
10321041
"""
10331042
|> String.unindent
1043+
|> String.removeNewlinesAtEnds
10341044
, Just
10351045
(Let
10361046
{ bindings =
@@ -1054,6 +1064,7 @@ expr =
10541064
42
10551065
"""
10561066
|> String.unindent
1067+
|> String.removeNewlinesAtEnds
10571068
, Just
10581069
(Let
10591070
{ bindings =
@@ -1122,6 +1133,7 @@ expr =
11221133
]
11231134
"""
11241135
|> String.unindent
1136+
|> String.removeNewlinesAtEnds
11251137
, Just
11261138
(List
11271139
[ Int 1
@@ -1286,6 +1298,7 @@ expr =
12861298
_ -> False
12871299
"""
12881300
|> String.unindent
1301+
|> String.removeNewlinesAtEnds
12891302
, Just
12901303
(Case (Int 21)
12911304
[ { pattern = PInt 31, body = Bool True }
@@ -1312,6 +1325,7 @@ expr =
13121325
False
13131326
"""
13141327
|> String.unindent
1328+
|> String.removeNewlinesAtEnds
13151329
, Just
13161330
(Case (Var { name = "arg", qualifiedness = PossiblyQualified Nothing })
13171331
[ { pattern = PTuple (PChar 'c') (PInt 23)
@@ -1535,6 +1549,7 @@ type_ =
15351549
}
15361550
"""
15371551
|> String.unindent
1552+
|> String.removeNewlinesAtEnds
15381553
, ConcreteType.Record <|
15391554
Dict.fromList
15401555
[ ( "x", ConcreteType.Int )
@@ -1586,7 +1601,12 @@ valueDeclaration =
15861601
)
15871602
)
15881603
, ( "simple with annotation"
1589-
, "y : ()\ny = ()"
1604+
, """
1605+
y : ()
1606+
y = ()
1607+
"""
1608+
|> String.unindent
1609+
|> String.removeNewlinesAtEnds
15901610
, Just
15911611
( "y"
15921612
, Declaration.Value
@@ -1626,10 +1646,42 @@ valueDeclaration =
16261646
)
16271647
, ( "user defined type with argument - newline only"
16281648
, """
1629-
x : Foo
1630-
()
1631-
x = ()
1632-
"""
1649+
x : Foo
1650+
()
1651+
x = ()
1652+
"""
1653+
|> String.unindent
1654+
|> String.removeNewlinesAtEnds
1655+
, Nothing
1656+
)
1657+
, ( "type on a newline+space"
1658+
, """
1659+
x :
1660+
()
1661+
x = ()
1662+
"""
1663+
|> String.unindent
1664+
|> String.removeNewlinesAtEnds
1665+
, Just
1666+
( "x"
1667+
, Declaration.Value
1668+
{ expression = Unit
1669+
, typeAnnotation =
1670+
Just
1671+
{ varName = "x"
1672+
, type_ = ConcreteType.Unit
1673+
}
1674+
}
1675+
)
1676+
)
1677+
, ( "type on a newline without space"
1678+
, """
1679+
x :
1680+
()
1681+
x = ()
1682+
"""
1683+
|> String.unindent
1684+
|> String.removeNewlinesAtEnds
16331685
, Nothing
16341686
)
16351687
]

0 commit comments

Comments
 (0)