From 60acecb9933b37270c2d3ae0cd3a26e0b1ffc12a Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 2 Dec 2025 14:26:45 +0000 Subject: [PATCH] Make test tree reflect directory tree --- app/Main.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 9a83835..bbcbd27 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -23,18 +23,17 @@ main = defaultMain . localOption (Always :: UseColor) . testGroup "tests" - $ map - puzzleTest - [ puzzle1 - , puzzle2 - ] + $ ["examples", "real"] <&> \s -> + testGroup s $ + puzzleTest s + <$> [ puzzle1 + , puzzle2 + ] -puzzleTest :: Puzzle -> TestTree -puzzleTest Puzzle{number, parser, parts} = - testGroup pt $ - ["examples", "real"] <&> \t -> +puzzleTest :: FilePath -> Puzzle -> TestTree +puzzleTest t Puzzle{number, parser, parts} = withResource (parseFile $ "inputs/" <> t <> "/" <> pt) mempty \input -> - testGroup t $ + testGroup pt $ zip (map show [1 :: Int ..]) parts <&> \(n, pp) -> goldenVsString n ("outputs/" <> t <> "/" <> pt <> "/" <> n) $ BL.fromStrict . encodeUtf8 . pp <$> input