Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit ba8e3f7

Browse files
committed
Use testPropertyNamed.
1 parent 2dd1df8 commit ba8e3f7

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

semantic-source/test/Range/Test.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE OverloadedStrings #-}
12
module Range.Test
23
( testTree
34
) where
@@ -8,12 +9,12 @@ import qualified Hedgehog.Gen as Gen
89
import qualified Hedgehog.Range as Range
910
import Source.Range
1011
import qualified Test.Tasty as Tasty
11-
import Test.Tasty.Hedgehog (testProperty)
12+
import Test.Tasty.Hedgehog (testPropertyNamed)
1213

1314
testTree :: Tasty.TestTree
1415
testTree = Tasty.testGroup "Source.Range"
1516
[ Tasty.testGroup "Semigroup"
16-
[ testProperty "associativity" . property $ do
17+
[ testPropertyNamed "associativity" "Range_associativity" . property $ do
1718
(a, b, c) <- forAll ((,,) <$> range <*> range <*> range)
1819
a <> (b <> c) === (a <> b) <> c
1920
]

semantic-source/test/Source/Test.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import qualified Source.Source as Source
1111
import Source.Span
1212
import qualified Test.Tasty as Tasty
1313
import Test.Tasty.HUnit
14-
import Test.Tasty.Hedgehog (testProperty)
14+
import Test.Tasty.Hedgehog (testPropertyNamed)
1515

1616

1717
source :: MonadGen m => Range.Range Int -> m Source.Source
@@ -22,23 +22,23 @@ source r = Gen.frequency [ (1, empty), (20, nonEmpty) ] where
2222
testTree :: Tasty.TestTree
2323
testTree = Tasty.testGroup "Source.Source"
2424
[ Tasty.testGroup "lineRanges"
25-
[ testProperty "produces 1 more range than there are newlines" . property $ do
25+
[ testPropertyNamed "produces 1 more range than there are newlines" "Source_lineRanges_produces_1_more_range_than_there_are_newlines" . property $ do
2626
source <- forAll (source (Range.linear 0 100))
2727
summarize source
2828
length (Source.lineRanges source) === length (Text.splitOn "\r\n" (Source.toText source) >>= Text.splitOn "\r" >>= Text.splitOn "\n")
2929

30-
, testProperty "produces exhaustive ranges" . property $ do
30+
, testPropertyNamed "produces exhaustive ranges" "Source_lineRanges_produces_exhaustive_ranges" . property $ do
3131
source <- forAll (source (Range.linear 0 100))
3232
summarize source
3333
foldMap (Source.slice source) (Source.lineRanges source) === source
3434
]
3535

3636
, Tasty.testGroup "totalSpan"
37-
[ testProperty "covers single lines" . property $ do
37+
[ testPropertyNamed "covers single lines" "Source_totalSpan_covers_single_lines" . property $ do
3838
n <- forAll $ Gen.int (Range.linear 0 100)
3939
Source.totalSpan (Source.fromText (Text.replicate n "*")) === Span (Pos 1 1) (Pos 1 (max 1 (succ n)))
4040

41-
, testProperty "covers multiple lines" . property $ do
41+
, testPropertyNamed "covers multiple lines" "Source_totalSpan_covers_multiple_lines" . property $ do
4242
n <- forAll $ Gen.int (Range.linear 0 100)
4343
Source.totalSpan (Source.fromText (Text.intersperse '\n' (Text.replicate n "*"))) === Span (Pos 1 1) (Pos (max 1 n) (if n > 0 then 2 else 1))
4444
]

0 commit comments

Comments
 (0)