-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- For known exceptions (i.e. TextException), do not print callstack. This also fixes a test bug where GHC 9.8 and 10 had different outputs (latter had callstacks). - Improve functional tests so that chart tests use the CLI, like everything else.
- Loading branch information
Showing
9 changed files
with
153 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,55 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
|
||
module Main (main) where | ||
|
||
import FileSystem.OsPath (decodeLenient) | ||
import Functional.Chart qualified | ||
import Functional.Derive qualified | ||
import Functional.Prelude | ||
import Functional.Scale qualified | ||
import Test.Tasty (defaultMain, localOption) | ||
import System.Directory.OsPath qualified as Dir | ||
import System.Environment.Guard | ||
import Test.Tasty (defaultMain, localOption, withResource) | ||
import Test.Tasty.Golden (DeleteOutputFile (OnPass)) | ||
|
||
main :: IO () | ||
main = | ||
defaultMain | ||
$ localOption OnPass | ||
$ testGroup | ||
"Functional" | ||
[ Functional.Chart.tests, | ||
Functional.Derive.tests, | ||
Functional.Scale.tests | ||
] | ||
$ withResource setup teardown | ||
$ \getTestDir -> | ||
testGroup | ||
"Functional" | ||
[ Functional.Chart.tests getTestDir, | ||
Functional.Derive.tests, | ||
Functional.Scale.tests | ||
] | ||
|
||
setup :: IO OsPath | ||
setup = do | ||
rootTmpDir <- (</> [osp|pacer|]) <$> Dir.getTemporaryDirectory | ||
let tmpDir = rootTmpDir </> tmpName | ||
|
||
-- Make sure we delete any leftover files from a previous run, so tests | ||
-- have a clean environment. | ||
dirExists <- Dir.doesDirectoryExist tmpDir | ||
when dirExists (Dir.removeDirectoryRecursive tmpDir) | ||
|
||
Dir.createDirectoryIfMissing True tmpDir | ||
pure tmpDir | ||
where | ||
tmpName = [osp|test|] </> [osp|functional|] | ||
|
||
teardown :: OsPath -> IO () | ||
teardown tmpDir = guardOrElse' "NO_CLEANUP" ExpectEnvSet doNothing cleanup | ||
where | ||
cleanup = do | ||
dirExists <- Dir.doesDirectoryExist tmpDir | ||
when dirExists (Dir.removeDirectoryRecursive tmpDir) | ||
|
||
doNothing = | ||
putStrLn | ||
$ "*** Not cleaning up tmp dir: '" | ||
<> decodeLenient tmpDir | ||
<> "'" |
4 changes: 2 additions & 2 deletions
4
backend/test/functional/goldens/testDuplicateDateError.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
user error (Decode error at '': Found overlapping timestamps | ||
Error decoding toml file 'test/functional/data/testDuplicateDateError_runs.toml': Decode error at '': Found overlapping timestamps | ||
- <no title>: 2024-10-20T14:30:00 | ||
- A 5k: 2024-10-20) | ||
- A 5k: 2024-10-20 |