@@ -12,6 +12,7 @@ import Test.HUnit hiding (Test, path)
12main :: IO ()
12main :: IO ()
13main = defaultMain
13main = defaultMain
14 [ testCase "count scalars" caseCountScalars
14 [ testCase "count scalars" caseCountScalars
15+ , testCase "largest string" caseLargestString
17caseCountScalars :: Assertion
18caseCountScalars :: Assertion
@@ -27,3 +28,20 @@ caseCountScalars = do
27 fold res EventNone = Left res
28 fold res EventNone = Left res
28 fold res _ = Right res
29 fold res _ = Right res
29 accum = (0, 0, 0) :: (Int, Int, Int)
30 accum = (0, 0, 0) :: (Int, Int, Int)
32+caseLargestString :: Assertion
33+caseLargestString = do
34+ Right res <- decodeFile filePath fold accum
35+ res @?= (length expected, expected)
37+ expected = "this one is just a little bit bigger than the others"
38+ filePath = "test/largest-string.yaml"
39+ fold (i, s) (EventScalar bs _ _) =
40+ let s' = B8.unpack bs
45+ fold res EventNone = Left res
46+ fold res _ = Right res
47+ accum = (0, "no strings found")