Skip to content

Instantly share code, notes, and snippets.

@ulidtko
Last active May 3, 2024 07:39
Show Gist options
  • Save ulidtko/3ae90ea5d97d03906cd0a9022148dc49 to your computer and use it in GitHub Desktop.
Save ulidtko/3ae90ea5d97d03906cd0a9022148dc49 to your computer and use it in GitHub Desktop.
Mini-repro of a bug in tasty-discover

Mini-repro for a bug in tasty-discover.

Steps to reproduce

Install current version:

  • cabal install tasty-discover --constraint tasty-discover==5.0.0

In the directory of this gist:

  • tasty-discover ./Tree.hs _ Output.hs

Check the output:

  • grep 'qualified Foo' Output.hs

Actual

import qualified Foo
import qualified Foo.hs

Expected

import qualified Foo
module Foo where
test_Foo = undefined
module Foo where
test_Foo = undefined
{-# LINE 3 "./Tree.hs" #-}
{-# LANGUAGE FlexibleInstances #-}
module Main (main, ingredients, tests) where
import Prelude
import qualified Foo
import qualified Foo.hs
import qualified System.Environment as E
import qualified Test.Tasty as T
import qualified Test.Tasty.Ingredients as T
{- HLINT ignore "Use let" -}
class TestGroup a where testGroup :: String -> a -> IO T.TestTree
instance TestGroup T.TestTree where testGroup _ a = pure a
instance TestGroup [T.TestTree] where testGroup n a = pure $ T.testGroup n a
instance TestGroup (IO T.TestTree) where testGroup _ a = a
instance TestGroup (IO [T.TestTree]) where testGroup n a = T.testGroup n <$> a
tests :: IO T.TestTree
tests = do
t0 <- testGroup "Foo" Foo.test_Foo
t1 <- testGroup "Foo" Foo.hs.test_Foo
pure $ T.testGroup "./Tree.hs" [t0,t1]
ingredients :: [T.Ingredient]
ingredients = T.defaultIngredients
main :: IO ()
main = do
args <- E.getArgs
E.withArgs ([] ++ args) $ tests >>= T.defaultMainWithIngredients ingredients
{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --tree-display -optF --generated-module -optF Tree #-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment