<commit_before>{-# LANGUAGE ViewPatterns, TupleSections, RecordWildCards, ScopedTypeVariables, PatternGuards #-}

module Action.Test(testMain) where

import Query
import Action.CmdLine
import Action.Search
import Action.Server
import General.Util
import Input.Type


testMain :: CmdLine -> IO ()
testMain Test{} = do
    Input.Type.test
    Query.test
    Action.Server.test
    testURL
    putStrLn ""


testURL :: IO ()
testURL = testing "testURL" $ do
    let a === b = do
            res <- search (Database "output/all") (parseQuery a)
            case res of
                ItemEx{..}:_ | itemURL == b -> putChar '.'
                _ -> error $ show (a, b, take 1 res)
    let hackage x = "https://hackage.haskell.org/package/" ++ x
    "base" === hackage "base"
    "Prelude" === hackage "base/docs/Prelude.html"
    "map" === hackage "base/docs/Prelude.html#v:map"
--    "map package:base" === hackage "base/docs/Prelude.html#v:map"
    "True" === hackage "base/docs/Prelude.html#v:True"
    "Bool" === hackage "base/docs/Prelude.html#t:Bool"
    "String" === hackage "base/docs/Prelude.html#t:String"
    "Ord" === hackage "base/docs/Prelude.html#t:Ord"
    ">>=" === hackage "base/docs/Prelude.html#v:-62--62--61-"
    "foldl'" === hackage "base/docs/Data-List.html#v:foldl-39-"<commit_msg>skip the failing test, don't comment it out<commit_after>{-# LANGUAGE ViewPatterns, TupleSections, RecordWildCards, ScopedTypeVariables, PatternGuards #-}

module Action.Test(testMain) where

import Query
import Action.CmdLine
import Action.Search
import Action.Server
import General.Util
import Input.Type


testMain :: CmdLine -> IO ()
testMain Test{} = do
    Input.Type.test
    Query.test
    Action.Server.test
    testURL
    putStrLn ""


testURL :: IO ()
testURL = testing "testURL" $ do
    let a === b = do
            res <- search (Database "output/all") (parseQuery a)
            case res of
                ItemEx{..}:_ | itemURL == b -> putChar '.'
                _ -> error $ show (a, b, take 1 res)
    let hackage x = "https://hackage.haskell.org/package/" ++ x
    "base" === hackage "base"
    "Prelude" === hackage "base/docs/Prelude.html"
    "map" === hackage "base/docs/Prelude.html#v:map"
    skip $ "map package:base" === hackage "base/docs/Prelude.html#v:map"
    "True" === hackage "base/docs/Prelude.html#v:True"
    "Bool" === hackage "base/docs/Prelude.html#t:Bool"
    "String" === hackage "base/docs/Prelude.html#t:String"
    "Ord" === hackage "base/docs/Prelude.html#t:Ord"
    ">>=" === hackage "base/docs/Prelude.html#v:-62--62--61-"
    "foldl'" === hackage "base/docs/Data-List.html#v:foldl-39-"
{'fraction_non_alphanumeric': 0.1663508904888215, 'fraction_numerical': 0.006820765441455097, 'mean_word_length': 3.012158054711246, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4396129', 'n_tokens_mistral': 962, 'n_tokens_neox': 930, 'n_words': 203}