1- {- AUTOCOLLECT.TEST -}
21{-# LANGUAGE QuasiQuotes #-}
32
4- module Tests.Model.Pattern
5- (
6- {- AUTOCOLLECT.TEST.export -}
7- )
8- where
3+ module Tests.Model.Pattern (test ) where
94
105import Check.Track qualified as Track
116import Hedgehog ((===) )
@@ -26,6 +21,18 @@ import Test.Tasty.HUnit qualified as Tasty
2621import Test.Tasty.Hedgehog qualified as Tasty
2722import Text.Megaparsec qualified as Megaparsec
2823
24+ test :: Tasty. TestTree
25+ test =
26+ Tasty. testGroup
27+ " Model.Pattern"
28+ [ testParseRoundTrip,
29+ testStaticPatterns,
30+ testTagPattern,
31+ testOtherPatterns,
32+ testParser,
33+ testFormatting
34+ ]
35+
2936patternGen :: Hedgehog. Gen Pattern. Pattern
3037patternGen = HedgehogGen. nonEmpty (HedgehogRange. linear 1 5 ) componentGen
3138
@@ -62,15 +69,15 @@ textGen :: Hedgehog.Gen Text
6269textGen =
6370 HedgehogGen. text (HedgehogRange. linear 1 10 ) HedgehogGen. alphaNum
6471
65- test :: TestTree
66- test =
72+ testParseRoundTrip :: Tasty. TestTree
73+ testParseRoundTrip =
6774 Tasty. testPropertyNamed " parse" " test_parse_pattern" $ Hedgehog. property $ do
6875 pattern <- Hedgehog. forAll patternGen
6976 Megaparsec. parse Pattern. parser " " (Pattern. asText pattern )
7077 === Right pattern
7178
72- test :: TestTree
73- test =
79+ testStaticPatterns :: Tasty. TestTree
80+ testStaticPatterns =
7481 Tasty. testGroup
7582 " Static patterns"
7683 [ testFileMatchesAndToPath
@@ -107,8 +114,8 @@ test =
107114 (trackWithFile [absfile |/some-path/to-somewhere/audio.mp3|])
108115 ]
109116
110- test :: TestTree
111- test =
117+ testTagPattern :: Tasty. TestTree
118+ testTagPattern =
112119 Tasty. testGroup
113120 " Tag patterns"
114121 [ testFileMatchesAndToPath
@@ -225,8 +232,8 @@ testFileMatchesAndToPath text pattern track@AudioTrack.AudioTrack {..} =
225232 where
226233 root = [absdir |/|]
227234
228- test :: TestTree
229- test =
235+ testOtherPatterns :: Tasty. TestTree
236+ testOtherPatterns =
230237 Tasty. testGroup
231238 " Other patterns"
232239 [ Tasty. testCase
@@ -241,8 +248,8 @@ test =
241248 `shouldBe` False
242249 ]
243250
244- test :: TestTree
245- test =
251+ testParser :: Tasty. TestTree
252+ testParser =
246253 Tasty. testGroup
247254 " Pattern parser"
248255 [ Tasty. testCase " single text" $
@@ -287,8 +294,8 @@ test =
287294 ]
288295 ]
289296
290- test :: TestTree
291- test =
297+ testFormatting :: Tasty. TestTree
298+ testFormatting =
292299 Tasty. testGroup
293300 " Formatting options"
294301 [ Tasty. testCase " no substitutions" $
0 commit comments