qute

A software analysis framework built around the QBE intermediate language

git clone https://git.8pit.net/qute.git

 1-- SPDX-FileCopyrightText: 2025-2026 Sören Tempel <soeren+git@soeren-tempel.net>
 2--
 3-- SPDX-License-Identifier: GPL-3.0-only
 4
 5module Main (main) where
 6
 7import Control.Monad (unless)
 8import Data.Maybe (isJust)
 9import Golden
10import Parser
11import System.Directory (findExecutable)
12import System.IO (hPutStrLn, stderr)
13import Test.Tasty
14import Types
15
16main :: IO ()
17main = do
18  hasQBE <- isJust <$> findExecutable "qbe"
19  unless hasQBE $
20    hPutStrLn stderr "WARNING: qbe(1) not installed, skipping Golden tests!"
21  defaultMain $ tests hasQBE
22
23-- Golden tests require qbe(1) to be installed, which is not available on Hackage.
24tests :: Bool -> TestTree
25tests hasQBE =
26  let testTree =
27        if hasQBE
28          then baseTests ++ [goldenTests]
29          else baseTests
30   in testGroup "Tests" testTree
31  where
32    baseTests = [mkParser, typesTests]