Add back tests for List/indexed (#405)

This adds back the missing tests for `List/indexed` (and fixes the
test failures)
This commit is contained in:
Gabriel Gonzalez 2018-05-27 06:39:21 -07:00 committed by GitHub
parent 8a7f221c18
commit 508327d56f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View File

@ -1438,8 +1438,7 @@ normalizeWith ctx e0 = loop (denote e0)
m = case Data.Sequence.viewr ys of
_ :> y -> Just y
_ -> Nothing
App (App ListIndexed _A) (ListLit _A as) ->
loop (ListLit (Just _A) as)
App (App ListIndexed _A) (ListLit _A as) -> loop (ListLit t as)
where
as = Data.Sequence.mapWithIndex adapt as
@ -1449,6 +1448,9 @@ normalizeWith ctx e0 = loop (denote e0)
, ("value", _A)
]
t | null as = Just _A
| otherwise = Nothing
adapt n a_ =
RecordLit (Data.HashMap.Strict.InsOrd.fromList kvs)
where

View File

@ -87,6 +87,8 @@ preludeExamples =
, shouldNormalize "List/generate" "./examples/List/generate/1"
, shouldNormalize "List/head" "./examples/List/head/0"
, shouldNormalize "List/head" "./examples/List/head/1"
, shouldNormalize "List/indexed" "./examples/List/indexed/0"
, shouldNormalize "List/indexed" "./examples/List/indexed/1"
, shouldNormalize "List/iterate" "./examples/List/iterate/0"
, shouldNormalize "List/iterate" "./examples/List/iterate/1"
, shouldNormalize "List/last" "./examples/List/last/0"

View File

@ -1 +1 @@
../../../../../Prelude/List/indexed Bool ([] : List Bool)
../../../../../Prelude/List/indexed Bool [ True, False, True ]

View File

@ -1,4 +1,4 @@
[ { index = +0, value = True }
, { index = +1, value = False }
, { index = +2, valu;e = True }
[ { index = 0, value = True }
, { index = 1, value = False }
, { index = 2, value = True }
]