我一直试图通过doctest
进行单元测试。得到错误:
hs-procr-0.1.0.0: test (suite: hs-procr-test)
Progress: 1/2
<interactive>:5:14: error:
Ambiguous occurrence ‘stdout’
It could refer to either ‘Turtle.stdout’,
imported from ‘Turtle’ at app/Main.hs:7:1-13
(and originally defined in ‘Turtle.Prelude’)
or ‘System.IO.stdout’,
imported from ‘System.IO’
(and originally defined in ‘GHC.IO.Handle.FD’)
我不知道为什么;我的所有*.hs
个文件都已
import System.IO hiding (FilePath, stdout, stderr)
package.yaml
:
...
tests:
hs-procr-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- hs-procr
Spec.hs
:
module Main (main) where
import Test.DocTest
import System.IO hiding (FilePath, stdout, stderr)
main :: IO ()
main = doctest [ "app/Main.hs"
]
我使用stack
,没有* .cabal文件。我错过了什么?
Main.hs
:
{-# LANGUAGE OverloadedStrings #-}
module Main ( main
, strStripNumbers
) where
import Lib
import Turtle
import Prelude hiding (FilePath)
import System.IO hiding (FilePath, stdout, stderr)
import Text.Regex.TDFA
...