<commit_before>-- | Generate the web site/documentation for the Fay project.
--
-- This depends on the Fay compiler to generate examples and the
-- javascript of the page is also built with Fay.

module Main where

import           Control.Monad
import           Data.Default
import           Data.List
import           Language.Fay.Compiler
import           Language.Fay.Types
import           System.Directory
import           System.FilePath
import           System.Process.Extra
import qualified Test.Api              as Api
import qualified Test.CommandLine      as Cmd
import qualified Test.Convert          as C
import           Test.HUnit

-- | Main test runner.
main :: IO ()
main = do
  putStrLn "Running API tests ..."
  void $ runTestTT Api.tests
  putStrLn "Running command line tests ..."
  void $ runTestTT Cmd.tests
  putStrLn "Running compiler tests ..."
  void runUnitTests
  putStrLn "Running serialization tests ..."
  void (C.runShowToFayTests False)

-- | Run the case-by-case unit tests.
runUnitTests :: IO Counts
runUnitTests = do
  files <- fmap (map ("tests" </>) . sort . filter dotHs) $ getDirectoryContents "tests"<commit_msg>Actually run the 'read' tests<commit_after>-- | Generate the web site/documentation for the Fay project.
--
-- This depends on the Fay compiler to generate examples and the
-- javascript of the page is also built with Fay.

module Main where

import           Control.Monad
import           Data.Default
import           Data.List
import           Language.Fay.Compiler
import           Language.Fay.Types
import           System.Directory
import           System.FilePath
import           System.Process.Extra
import qualified Test.Api              as Api
import qualified Test.CommandLine      as Cmd
import qualified Test.Convert          as C
import           Test.HUnit

-- | Main test runner.
main :: IO ()
main = do
  putStrLn "Running API tests ..."
  void $ runTestTT Api.tests
  putStrLn "Running command line tests ..."
  void $ runTestTT Cmd.tests
  putStrLn "Running compiler tests ..."
  void runUnitTests
  putStrLn "Running serialization tests ..."
  void (C.runShowToFayTests False)
  void (C.runReadFromFayTests False)

-- | Run the case-by-case unit tests.
runUnitTests :: IO Counts
runUnitTests = do
  files <- fmap (map ("tests" </>) . sort . filter dotHs) $ getDirectoryContents "tests"
{'fraction_non_alphanumeric': 0.07913669064748201, 'fraction_numerical': 0.0, 'mean_word_length': 2.4815905743740796, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '4280792', 'n_tokens_mistral': 658, 'n_tokens_neox': 640, 'n_words': 244}