Haskell Stack Ghci test-suite

前端 未结 1 569
Happy的楠姐
Happy的楠姐 2021-02-05 17:37

I\'m trying to use stack to load my test-suite in ghci and have it load the QuickCheck and hspec dependency.

How can I do this?

I\'m using the franklinchen templ

1条回答
  •  自闭症患者
    2021-02-05 17:58

    stack ghci --test
    

    Note that this will only work if there's a single test suite and no other executable. Otherwise it will give you a warning:

    * * * * * * * *
    The main module to load is ambiguous. Candidates are:
    Package `project' component exe:project-exe with main-is file: T:\project\app\Main.hs
    Package `project' component test:project-test with main-is file: T:\project\test\Spec.hs
    None will be loaded. You can specify which one to pick by:
     1) Specifying targets to stack ghci e.g. stack ghci project:exe:project-exe
     2) Specifying what the main is e.g. stack ghci --main-is project:exe:project-exe
    * * * * * * * *

    In this case you have to use

    stack ghci --test chapterexercises:test:spec
    

    Without --test stack is going to ignore the tests. That's why you don't get the ambiguity error in the first place.

    0 讨论(0)
提交回复
热议问题