@@ -196,6 +196,22 @@ lookAheadPass =
196 Right (ls_1, ls_2) -> (ls_1 == ls_2) && (ls_1 == Prelude.take n ls)
196 Right (ls_1, ls_2) -> (ls_1 == ls_2) && (ls_1 == Prelude.take n ls)
197 Left _ -> False
197 Left _ -> False
199+lookAheadFail :: Property
201+ forAll (chooseInt (min_value + 1, max_value)) $ \n ->
203+ takeWithoutConsume = P.lookAhead $ P.take n FL.toList
205+ parsed_list_1 <- takeWithoutConsume
206+ parsed_list_2 <- takeWithoutConsume
207+ return (parsed_list_1, parsed_list_2)
209+ forAll (chooseInt (min_value, n - 1)) $ \list_length ->
210+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
211+ case S.parse parseTwice (S.fromList ls) of
199lookAhead :: Property
215lookAhead :: Property
200lookAhead =
216lookAhead =
201 forAll (chooseInt (min_value, max_value)) $ \n ->
217 forAll (chooseInt (min_value, max_value)) $ \n ->
@@ -380,6 +396,7 @@ main = hspec $ do
380 prop "takeGE on list of length >= n" takeGEPass
396 prop "takeGE on list of length >= n" takeGEPass
381 prop "takeGE on arbitrary sized list and n" Main.takeGE
397 prop "takeGE on arbitrary sized list and n" Main.takeGE
382 prop "parse stream twice without exceeding length of list, then check eq of lists" lookAheadPass
398 prop "parse stream twice without exceeding length of list, then check eq of lists" lookAheadPass
399+ prop "parse stream and exceed the length of stream while parsing" lookAheadFail
383 prop "parse stream twice, then check eq of lists if not failed, else check why failed" lookAhead
400 prop "parse stream twice, then check eq of lists if not failed, else check why failed" lookAhead
384 prop "compare takeWhile of parser and prelude on list and predicate" Main.takeWhile
401 prop "compare takeWhile of parser and prelude on list and predicate" Main.takeWhile
385 prop "compare with prelude.takeWhile if taken something, else check why failed" takeWhile1
402 prop "compare with prelude.takeWhile if taken something, else check why failed" takeWhile1