File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
433439main :: IO ()
434440main = 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
You can’t perform that action at this time.
0 commit comments