Skip to content

Commit 0833b21

Browse files
committed
Remove tasty-autocollect
1 parent f9e964b commit 0833b21

10 files changed

Lines changed: 114 additions & 87 deletions

File tree

‎htagcli.cabal‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ test-suite tests
129129
Tests.Model.Pattern
130130
Tests.Model.Tag
131131

132-
ghc-options:
133-
-F
134-
-pgmF=tasty-autocollect
135-
136132
build-depends:
137133
hedgehog,
138134
hspec,
@@ -147,7 +143,6 @@ test-suite tests
147143
path-io,
148144
resourcet,
149145
tasty,
150-
tasty-autocollect,
151146
tasty-expected-failure,
152147
tasty-hedgehog,
153148
tasty-hunit-compat,

‎tests/Main.hs‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
{- AUTOCOLLECT.MAIN -}
1+
module Main (main) where
2+
3+
import Test.Tasty (defaultMain, testGroup)
4+
import Tests.Check.Album qualified as Check.Album
5+
import Tests.Check.Artist qualified as Check.Artist
6+
import Tests.Check.Track qualified as Check.Track
7+
import Tests.Commands as Commands
8+
import Tests.Config as Config
9+
import Tests.Model.AudioTrack qualified as Model.AudioTrack
10+
import Tests.Model.Pattern qualified as Model.Pattern
11+
import Tests.Model.Tag qualified as Model.Tag
12+
13+
main :: IO ()
14+
main =
15+
defaultMain $
16+
testGroup
17+
"Tests"
18+
[ Commands.test,
19+
Config.test,
20+
Model.AudioTrack.test,
21+
Model.Pattern.test,
22+
Model.Tag.test,
23+
Check.Album.test,
24+
Check.Artist.test,
25+
Check.Track.test
26+
]

‎tests/Tests/Check/Album.hs‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{- AUTOCOLLECT.TEST -}
21
{-# LANGUAGE QuasiQuotes #-}
32

4-
module Tests.Check.Album
5-
(
6-
{- AUTOCOLLECT.TEST.export -}
7-
)
8-
where
3+
module Tests.Check.Album (test) where
94

105
import Check.Album qualified as Album
116
import Data.List.NonEmpty ((<|))
@@ -23,8 +18,18 @@ import Test.Tasty qualified as Tasty
2318
import Test.Tasty.HUnit qualified as Tasty
2419
import Tests.Common qualified as Common
2520

26-
test :: TestTree
21+
test :: Tasty.TestTree
2722
test =
23+
Tasty.testGroup
24+
"Check.Album"
25+
[ testCheckCover,
26+
testCheckDirectory,
27+
testCheckSameTags,
28+
testCheckSequential
29+
]
30+
31+
testCheckCover :: Tasty.TestTree
32+
testCheckCover =
2833
Tasty.testGroup
2934
"check cover"
3035
[ Tasty.testCase "check an album without a cover.png" $
@@ -80,8 +85,8 @@ test =
8085
}
8186
covers = fromList [[relfile|cover.jpg|], [relfile|cover.png|]]
8287

83-
test :: TestTree
84-
test =
88+
testCheckDirectory :: Tasty.TestTree
89+
testCheckDirectory =
8590
Tasty.testGroup
8691
"check directory"
8792
[ Tasty.testCase "an album is in a single directory" $ do
@@ -105,8 +110,8 @@ test =
105110
{ AudioTrack.atFile = newDir </> Path.filename (AudioTrack.atFile track)
106111
}
107112

108-
test :: TestTree
109-
test =
113+
testCheckSameTags :: Tasty.TestTree
114+
testCheckSameTags =
110115
Tasty.testGroup
111116
"check same tags"
112117
[ Tasty.testCase "all tracks have the same tags" $ do
@@ -120,8 +125,8 @@ test =
120125
where
121126
commonTags = fromList [Tag.Genre, Tag.Year, Tag.Artist, Tag.AlbumArtist]
122127

123-
test :: TestTree
124-
test =
128+
testCheckSequential :: Tasty.TestTree
129+
testCheckSequential =
125130
Tasty.testGroup
126131
"check sequential tracks"
127132
[ Tasty.testCase "the tracks are sequential" $ do

‎tests/Tests/Check/Artist.hs‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{- AUTOCOLLECT.TEST -}
21
{-# LANGUAGE QuasiQuotes #-}
32

4-
module Tests.Check.Artist
5-
(
6-
{- AUTOCOLLECT.TEST.export -}
7-
)
8-
where
3+
module Tests.Check.Artist (test) where
94

105
import Check.Artist qualified as Artist
116
import Model.Artist qualified as Artist
@@ -17,10 +12,10 @@ import Test.Tasty qualified as Tasty
1712
import Test.Tasty.HUnit qualified as Tasty
1813
import Tests.Common qualified as Common
1914

20-
test :: TestTree
15+
test :: Tasty.TestTree
2116
test =
2217
Tasty.testGroup
23-
"check artist"
18+
"Check.Artist"
2419
[ Tasty.testCase "two albums of the same artist with the same genre" $ do
2520
let album1 = tenTracksAlbum (HTagLib.mkAlbum "album-1") rock
2621
album2 = tenTracksAlbum (HTagLib.mkAlbum "album-2") rock

‎tests/Tests/Check/Track.hs‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{- AUTOCOLLECT.TEST -}
21
{-# LANGUAGE QuasiQuotes #-}
32

4-
module Tests.Check.Track
5-
(
6-
{- AUTOCOLLECT.TEST.export -}
7-
)
8-
where
3+
module Tests.Check.Track (test) where
94

105
import Check.Track qualified as Track
116
import Model.AudioTrack qualified as AudioTrack
@@ -18,8 +13,15 @@ import Test.Hspec.Expectations (shouldBe)
1813
import Test.Tasty qualified as Tasty
1914
import Test.Tasty.HUnit qualified as Tasty
2015

21-
test :: TestTree
16+
test :: Tasty.TestTree
2217
test =
18+
Tasty.testGroup
19+
"Check.Track"
20+
[ testFilenameMatches
21+
]
22+
23+
testFilenameMatches :: Tasty.TestTree
24+
testFilenameMatches =
2325
Tasty.testGroup
2426
"FilenameMatches"
2527
[ Tasty.testCase

‎tests/Tests/Commands.hs‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{- AUTOCOLLECT.TEST -}
21
{-# LANGUAGE QuasiQuotes #-}
32

4-
module Tests.Commands
5-
(
6-
{- AUTOCOLLECT.TEST.export -}
7-
)
8-
where
3+
module Tests.Commands (test) where
94

105
import Check.Track qualified as Track
116
import Commands qualified
@@ -23,8 +18,11 @@ import Test.Tasty qualified as Tasty
2318
import Test.Tasty.HUnit qualified as Tasty
2419
import Tests.Common qualified as Common
2520

26-
test :: TestTree
27-
test =
21+
test :: Tasty.TestTree
22+
test = Tasty.testGroup "Commands" [testFixFilePaths]
23+
24+
testFixFilePaths :: Tasty.TestTree
25+
testFixFilePaths =
2826
Tasty.testGroup
2927
"fixFilePaths"
3028
[ Tasty.testCase "dry run" $

‎tests/Tests/Config.hs‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
{- AUTOCOLLECT.TEST -}
2-
module Tests.Config
3-
(
4-
{- AUTOCOLLECT.TEST.export -}
5-
)
6-
where
1+
module Tests.Config (test) where
72

83
import Config qualified
94
import Test.Hspec.Expectations (shouldSatisfy)
5+
import Test.Tasty qualified as Tasty
106
import Test.Tasty.HUnit qualified as Tasty
117
import UnliftIO.Exception qualified as Exception
128

13-
test :: TestTree
14-
test =
9+
test :: Tasty.TestTree
10+
test = Tasty.testGroup "Config" [testParseDefaultConfig]
11+
12+
testParseDefaultConfig :: Tasty.TestTree
13+
testParseDefaultConfig =
1514
Tasty.testCase "Default config should parse" $ do
1615
result <-
1716
Exception.tryAny $ Config.parseByteString Config.defaultConfigContent

‎tests/Tests/Model/AudioTrack.hs‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
{- AUTOCOLLECT.TEST -}
21
{-# LANGUAGE QuasiQuotes #-}
32

4-
module Tests.Model.AudioTrack
5-
(
6-
{- AUTOCOLLECT.TEST.export -}
7-
)
8-
where
3+
module Tests.Model.AudioTrack (test) where
94

105
import Control.Monad.Morph qualified as Morph
116
import Control.Monad.Trans.Resource qualified as Resource
@@ -25,6 +20,14 @@ import Test.Tasty qualified as Tasty
2520
import Test.Tasty.Hedgehog qualified as Tasty
2621
import Text.Megaparsec qualified as Megaparsec
2722

23+
test :: Tasty.TestTree
24+
test =
25+
Tasty.testGroup
26+
"Model.AudioTrack"
27+
[ testParse,
28+
testSetGetRoundTrip
29+
]
30+
2831
audioTrackGen :: Hedgehog.Gen AudioTrack.AudioTrack
2932
audioTrackGen = do
3033
atFile <- absFileGen
@@ -60,8 +63,8 @@ absFileGen = do
6063
pathPieceGen =
6164
HedgehogGen.string (HedgehogRange.linear 1 20) HedgehogGen.alphaNum
6265

63-
test :: TestTree
64-
test =
66+
testParse :: Tasty.TestTree
67+
testParse =
6568
Tasty.testGroup
6669
"Parse"
6770
[ Tasty.testPropertyNamed "one" "test_parse_one" $ Hedgehog.property $ do
@@ -77,8 +80,8 @@ test =
7780
=== Right audioTracks
7881
]
7982

80-
test :: TestTree
81-
test =
83+
testSetGetRoundTrip :: Tasty.TestTree
84+
testSetGetRoundTrip =
8285
Tasty.testPropertyNamed "roundtrip" "test_set_get" $ do
8386
Hedgehog.property . Morph.hoist Resource.runResourceT $ do
8487
(_, tempDir) <-

‎tests/Tests/Model/Pattern.hs‎

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
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

105
import Check.Track qualified as Track
116
import Hedgehog ((===))
@@ -26,6 +21,18 @@ import Test.Tasty.HUnit qualified as Tasty
2621
import Test.Tasty.Hedgehog qualified as Tasty
2722
import 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+
2936
patternGen :: Hedgehog.Gen Pattern.Pattern
3037
patternGen = HedgehogGen.nonEmpty (HedgehogRange.linear 1 5) componentGen
3138

@@ -62,15 +69,15 @@ textGen :: Hedgehog.Gen Text
6269
textGen =
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" $

‎tests/Tests/Model/Tag.hs‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
{- AUTOCOLLECT.TEST -}
2-
3-
module Tests.Model.Tag
4-
(
5-
{- AUTOCOLLECT.TEST.export -}
6-
)
7-
where
1+
module Tests.Model.Tag (test) where
82

93
import Hedgehog ((===))
104
import Hedgehog qualified
115
import Hedgehog.Gen qualified as Hedgehog
126
import Model.Tag qualified as Tag
7+
import Test.Tasty qualified as Tasty
138
import Test.Tasty.Hedgehog qualified as Tasty
149
import Text.Megaparsec qualified as Megaparsec
1510

16-
test :: TestTree
17-
test =
11+
test :: Tasty.TestTree
12+
test = Tasty.testGroup "Model.Tag" [testParseRoundTrip]
13+
14+
testParseRoundTrip :: Tasty.TestTree
15+
testParseRoundTrip =
1816
Tasty.testPropertyNamed "roundtrip" "test_parse_one" $ Hedgehog.property $ do
1917
tag <- Hedgehog.forAll Hedgehog.enumBounded
2018
Megaparsec.parse Tag.parser "" (Tag.asText tag) === Right tag

0 commit comments

Comments
 (0)