https://gitlab.inria.fr/abrenon/soprano
Tip revision: 3fc6efcf5444dee0c690d4d57aab06a50593ad8a authored by Alice Brenon on 25 November 2025, 13:33:00 UTC
Switch license to GPLv3 (https://www.gnu.org/licenses/gpl.html)
Switch license to GPLv3 (https://www.gnu.org/licenses/gpl.html)
Tip revision: 3fc6efc
Articles.hs
module Articles (
testArticles
) where
import Control.Monad.IO.Class (MonadIO(..))
import Distribution.TestSuite (Progress(..), Result(..), Test, testGroup)
import Mock.Headwords (headwords)
import Mock.Resource (simpleTest)
import Text.XML.Light.TEI.Article.SegmenterUtils (getArticleStart)
testHeadword :: (String, Bool) -> Test
testHeadword (input, expected) = simpleTest (takeWhile (/= ' ') input) [] $ do
actual <- maybe False (\_ -> True) <$> getArticleStart input
Finished <$>
if actual == expected
then return Pass
else do
liftIO . putStrLn $
"Expected «" ++ input ++ "» " ++ neg ++ "to be a headword"
return (Fail $ "False " ++ kind)
where
(neg, kind) = if expected then ("", "negative") else ("not ", "positive")
testArticles :: Test
testArticles = testGroup "articles" [
testGroup "headwords" $ testHeadword <$> headwords
]
