summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-03-06 23:32:59 +0100
committertv <tv@krebsco.de>2026-03-06 23:36:06 +0100
commit18fffd492fe7134ef1cc53e1725d1709ddbde20b (patch)
tree95a89458b1b7ebc67b02a53394609df5f095bd18 /test
parent7a9f03584573cbcef94a610e6aafa5d8be89722e (diff)
HyphenateSegments: Hyphenator -> Language
This way we don't need to define bad orphan instances.
Diffstat (limited to 'test')
-rw-r--r--test/Spec.hs44
1 files changed, 9 insertions, 35 deletions
diff --git a/test/Spec.hs b/test/Spec.hs
index 3ada0ea..c7c2cbd 100644
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -113,33 +113,7 @@ main = hspec do
describe "Item & SegmentStrategy" do
-
- it "Hyphenator Eq instance should consider identical hyphenators equal" do
- let hy = H.german_1996
- (hy == hy) `shouldBe` True
-
- it "HyphenateSegments with same hyphenator and same cache should be equal" do
- let hy = H.german_1996
- s1 = HyphenateSegments hy HM.empty
- s2 = HyphenateSegments hy HM.empty
- s1 == s2 `shouldBe` True
-
- it "Show Hyphenator should reflect differences between hyphenators" do
- let hy1 = H.german_1996
- hy2 = H.english_US
- show hy1 `shouldNotBe` show hy2
-
- it "Show HyphenateSegments should differ for different hyphenators" do
- let hy1 = H.german_1996
- hy2 = H.english_US
- s1 = HyphenateSegments hy1 HM.empty
- s2 = HyphenateSegments hy2 HM.empty
- show s1 `shouldNotBe` show s2
-
- it "Show HyphenateSegments should not expose internal cache structure" do
- let hy = H.german_1996
- s = HyphenateSegments hy (HM.fromList [("a",[("a","")])])
- show s `shouldNotContain` "fromList"
+ pure ()
describe "Render" do
@@ -256,11 +230,11 @@ main = hspec do
it "renderItem should invalidate cache when segmentation output changes" do
let old = CachedRender
{ crWidth = 5
- , crStrategy = HyphenateSegments H.german_1996 mempty
+ , crStrategy = HyphenateSegments H.German_1996 mempty
, crText = "Schifffahrt"
, crRendered = RenderedItem mempty
}
- itm = Item "Schifffahrt" (HyphenateSegments H.german_1996 mempty)
+ itm = Item "Schifffahrt" (HyphenateSegments H.German_1996 mempty)
new = renderItem 5 0 itm (Just old)
crRendered new `shouldNotBe` crRendered old
@@ -384,8 +358,8 @@ main = hspec do
["abcde","fgh"]
it "hyphenateWord splits German words" do
- let hy = H.german_1996
- hyphenateWord hy "Schifffahrt" `shouldSatisfy` (not . null)
+ let lang = H.German_1996
+ hyphenateWord lang "Schifffahrt" `shouldSatisfy` (not . null)
it "scoreCandidate is deterministic for identical candidates" do
let c = ("abcdefghijk", ["abcdefgh","ijk"], False)
@@ -406,14 +380,14 @@ main = hspec do
scanOffsetsFrom 0 ["abc","def"] `shouldBe` [0,4]
it "HyphenateSegments should return updated cache" do
- let dict = H.german_1996
+ let lang = H.German_1996
cache0 = HM.empty
- _v = applyStrategy (HyphenateSegments dict cache0) 5 0 "Schifffahrt"
+ _v = applyStrategy (HyphenateSegments lang cache0) 5 0 "Schifffahrt"
cache0 `shouldNotBe` (HM.empty :: HM.HashMap Text [(Text, Text)])
it "lineCandidates should preserve candidate order" do
- let dict = H.german_1996
- (cs, _) = lineCandidates dict 10 HM.empty ["a","b","c"]
+ let lang = H.German_1996
+ (cs, _) = lineCandidates lang 10 HM.empty ["a","b","c"]
map (\(t,_,_) -> t) cs `shouldBe` ["a","a b","a b c"]
it "breakWordSafe should not split grapheme clusters" do