@@ -501,6 +501,7 @@ expr =
501
501
x + 1
502
502
"""
503
503
|> String . unindent
504
+ |> String . removeNewlinesAtEnds
504
505
, Just
505
506
( Lambda
506
507
{ arguments = [ " x" ]
@@ -573,6 +574,7 @@ expr =
573
574
arg2
574
575
"""
575
576
|> String . unindent
577
+ |> String . removeNewlinesAtEnds
576
578
, Just
577
579
( Call
578
580
{ fn =
@@ -617,6 +619,7 @@ expr =
617
619
618
620
"""
619
621
|> String . unindent
622
+ |> String . removeNewlinesAtEnds
620
623
, Just
621
624
( If
622
625
{ test = Int 1
@@ -938,6 +941,7 @@ expr =
938
941
2
939
942
"""
940
943
|> String . unindent
944
+ |> String . removeNewlinesAtEnds
941
945
, Just
942
946
( Let
943
947
{ bindings =
@@ -957,6 +961,7 @@ expr =
957
961
2
958
962
"""
959
963
|> String . unindent
964
+ |> String . removeNewlinesAtEnds
960
965
, Nothing
961
966
)
962
967
, ( " allows result expr on the same indentation level as `let`"
@@ -967,6 +972,7 @@ expr =
967
972
2
968
973
"""
969
974
|> String . unindent
975
+ |> String . removeNewlinesAtEnds
970
976
, Just
971
977
( Let
972
978
{ bindings =
@@ -987,6 +993,7 @@ expr =
987
993
3
988
994
"""
989
995
|> String . unindent
996
+ |> String . removeNewlinesAtEnds
990
997
, Just
991
998
( Let
992
999
{ bindings =
@@ -1010,6 +1017,7 @@ expr =
1010
1017
3
1011
1018
"""
1012
1019
|> String . unindent
1020
+ |> String . removeNewlinesAtEnds
1013
1021
, Nothing
1014
1022
)
1015
1023
, ( " doesn't allow bindings to have different indentation from each other - the other way"
@@ -1021,6 +1029,7 @@ expr =
1021
1029
3
1022
1030
"""
1023
1031
|> String . unindent
1032
+ |> String . removeNewlinesAtEnds
1024
1033
, Nothing
1025
1034
)
1026
1035
, ( " one binding that's used in the body"
@@ -1031,6 +1040,7 @@ expr =
1031
1040
1 + x
1032
1041
"""
1033
1042
|> String . unindent
1043
+ |> String . removeNewlinesAtEnds
1034
1044
, Just
1035
1045
( Let
1036
1046
{ bindings =
@@ -1054,6 +1064,7 @@ expr =
1054
1064
42
1055
1065
"""
1056
1066
|> String . unindent
1067
+ |> String . removeNewlinesAtEnds
1057
1068
, Just
1058
1069
( Let
1059
1070
{ bindings =
@@ -1122,6 +1133,7 @@ expr =
1122
1133
]
1123
1134
"""
1124
1135
|> String . unindent
1136
+ |> String . removeNewlinesAtEnds
1125
1137
, Just
1126
1138
( List
1127
1139
[ Int 1
@@ -1286,6 +1298,7 @@ expr =
1286
1298
_ -> False
1287
1299
"""
1288
1300
|> String . unindent
1301
+ |> String . removeNewlinesAtEnds
1289
1302
, Just
1290
1303
( Case ( Int 21 )
1291
1304
[ { pattern = PInt 31 , body = Bool True }
@@ -1312,6 +1325,7 @@ expr =
1312
1325
False
1313
1326
"""
1314
1327
|> String . unindent
1328
+ |> String . removeNewlinesAtEnds
1315
1329
, Just
1316
1330
( Case ( Var { name = " arg" , qualifiedness = PossiblyQualified Nothing } )
1317
1331
[ { pattern = PTuple ( PChar ' c') ( PInt 23 )
@@ -1535,6 +1549,7 @@ type_ =
1535
1549
}
1536
1550
"""
1537
1551
|> String . unindent
1552
+ |> String . removeNewlinesAtEnds
1538
1553
, ConcreteType . Record <|
1539
1554
Dict . fromList
1540
1555
[ ( " x" , ConcreteType . Int )
@@ -1586,7 +1601,12 @@ valueDeclaration =
1586
1601
)
1587
1602
)
1588
1603
, ( " simple with annotation"
1589
- , " y : ()\n y = ()"
1604
+ , """
1605
+ y : ()
1606
+ y = ()
1607
+ """
1608
+ |> String . unindent
1609
+ |> String . removeNewlinesAtEnds
1590
1610
, Just
1591
1611
( " y"
1592
1612
, Declaration . Value
@@ -1626,10 +1646,42 @@ valueDeclaration =
1626
1646
)
1627
1647
, ( " user defined type with argument - newline only"
1628
1648
, """
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
1633
1685
, Nothing
1634
1686
)
1635
1687
]
0 commit comments