<commit_before>#!/usr/bin/env runhaskell

module Main(main) where

import Control.Concurrent
import Control.Exception
import Control.Monad

import qualified Data.Set as S
import Data.Char (isSpace)

import System.Directory
import System.Environment
import System.Exit
import System.FilePath
import System.IO
import System.Process

l0flags :: String
l0flags = "-utenohf"

-- | Number of concurrent l0c instances to run.
concurrency :: Int
concurrency = 8

clearLine :: IO ()
clearLine = putStr "\27[2K"

data TestResult = Success
                | Failure String

data Test = TypeFailure FilePath
          | TypeCheck FilePath
          | Run FilePath FilePath FilePath

failureTest :: FilePath -> IO TestResult
failureTest f = do
  (code, _, err) <- readProcessWithExitCode "l0c" [l0flags, f] ""
  case code of
    ExitSuccess -> return $ Failure "Expected failure\n"
    ExitFailure 1 -> return $ Failure err
    ExitFailure _ -> return Success

compileTest :: FilePath -> IO TestResult
compileTest f = do<commit_msg>Tweak the compiler flags used in test suite.<commit_after>#!/usr/bin/env runhaskell

module Main(main) where

import Control.Concurrent
import Control.Exception
import Control.Monad

import qualified Data.Set as S
import Data.Char (isSpace)

import System.Directory
import System.Environment
import System.Exit
import System.FilePath
import System.IO
import System.Process

l0flags :: String
l0flags = "-utenohefoe"

-- | Number of concurrent l0c instances to run.
concurrency :: Int
concurrency = 8

clearLine :: IO ()
clearLine = putStr "\27[2K"

data TestResult = Success
                | Failure String

data Test = TypeFailure FilePath
          | TypeCheck FilePath
          | Run FilePath FilePath FilePath

failureTest :: FilePath -> IO TestResult
failureTest f = do
  (code, _, err) <- readProcessWithExitCode "l0c" [l0flags, f] ""
  case code of
    ExitSuccess -> return $ Failure "Expected failure\n"
    ExitFailure 1 -> return $ Failure err
    ExitFailure _ -> return Success

compileTest :: FilePath -> IO TestResult
compileTest f = do
{'fraction_non_alphanumeric': 0.08156370656370657, 'fraction_numerical': 0.009652509652509652, 'mean_word_length': 3.6375838926174495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2079445', 'n_tokens_mistral': 617, 'n_tokens_neox': 588, 'n_words': 210}