Skip to content

localOption is ignored by defaultMain #32

@andreasabel

Description

@andreasabel

I am trying to set a local option for a test but it seems to be ignored by the test runner (defaultMain) of tasty-silver.

#!/usr/bin/env GHC_ENVIRONMENT=- runhaskell -packagetasty-1.4.2 -packagetasty-silver-3.2.2

{-# LANGUAGE OverloadedStrings #-}

import Test.Tasty (TestTree, localOption)
import Test.Tasty.Silver
import Test.Tasty.Silver.Advanced
import Test.Tasty.Silver.Interactive as Silver

main :: IO ()
main = Silver.defaultMain $ localOption (Interactive true) testGolden
  where
  true = error "This error should be triggered!"

testGolden :: TestTree
testGolden =
  goldenTest1
    "wrongOutput"
    (return $ Just "golden value")
    (return "actual value")
    (DiffText Nothing)   -- always fail
    ShowText
    (const $ return ())  -- keep the golden file no matter what

When applying and then querying the option, this script should crash with error. But it simply runs the test non-interactively.

@phile314: You implemented the test runner. Where should PlusTestOption be usually handled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugoptionConcerning options (OptionSet)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions