Skip to content

Commit add48ef

Browse files
committed
Simplify the alt tests
1 parent 17054ed commit add48ef

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

test/Streamly/Test/Data/Parser.hs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@ altD =
423423
<|> P.takeWhile (<= 7) FL.toList
424424
)
425425

426+
altTests :: Spec
427+
altTests =
428+
describe "alt" $ do
429+
it "alt2 [1..20]" $ alt2 (K.fromList [1..20]) `shouldReturn` Right [1..7]
430+
it "altD [1..20]" $ altD (S.fromList [1..20]) `shouldReturn` Right [1..7]
431+
426432
-------------------------------------------------------------------------------
427433
-- Main
428434
-------------------------------------------------------------------------------
@@ -432,19 +438,6 @@ moduleName = "Data.Parser"
432438

433439
main :: IO ()
434440
main = do
435-
-- TODO: convert this test to the same format as other tests.
436-
r <- alt2 (K.fromList [1..20])
437-
case r of
438-
Right x | x == [1..7] -> putStrLn "K.Alt parse successful"
439-
Right x -> error $ "K.Alt parse got incorrect output " ++ show x
440-
_ -> error $ "K.Alt parse failed"
441-
442-
r1 <- altD (S.fromList [1..20])
443-
case r1 of
444-
Right x | x == [1..7] -> putStrLn "Alt parse successful"
445-
Right x -> error $ "Alt parse got incorrect output " ++ show x
446-
_ -> error $ "Alt parse failed"
447-
448441
hspec $
449442
H.parallel $
450443
modifyMaxSuccess (const maxTestCount) $ do
@@ -474,4 +467,6 @@ main = do
474467
"\"hello\\\"\\\\w\\'orld\""
475468
["hello\"\\w\\'orld"]
476469

470+
471+
altTests
477472
Common.main

0 commit comments

Comments
 (0)