2016-01-01 9 views
11

मैं ghci में अपना टेस्ट-सूट लोड करने के लिए स्टैक का उपयोग करने की कोशिश कर रहा हूं और इसे क्विक चेक और एचएसपीसी निर्भरता लोड कर रहा हूं।हास्केल स्टैक घसी टेस्ट-सूट

मैं यह कैसे कर सकता हूं?

मैं फ्रैंकलिनचेन टेम्पलेट का उपयोग कर रहा हूं।
https://github.com/commercialhaskell/stack-templates/blob/master/franklinchen.hsfiles

मैं कोशिश की है
ढेर GHCi कल्पना
ढेर GHCi परीक्षण सूट
ढेर GHCi --main-है कल्पना

मैं परीक्षण-सुइट कल्पना को लक्षित करने के लिए संशोधित मुख्य है : LibSpec.hs फ़ाइल

test-suite spec 
    default-language: Haskell2010 
    ghc-options:   -Wall 
    type:    exitcode-stdio-1.0 
    hs-source-dirs:  test 
    main-is:    LibSpec.hs 
    build-depends:  base 
        , chapterexercises 
        , hspec 
        , QuickCheck 

उत्तर

13
stack ghci --test 

ध्यान दें कि यह केवल तभी काम करेगा जब कोई एकल परीक्षण सूट और कोई अन्य निष्पादन योग्य न हो। अन्यथा यह आपको एक चेतावनी दे देंगे:

* * * * * * * * 
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 
* * * * * * * *

इस मामले में आप

stack ghci --test chapterexercises:test:spec 

--test बिना ढेर परीक्षण की अनदेखी करने के लिए जा रहा है उपयोग करना होगा। यही कारण है कि आपको पहली जगह अस्पष्टता त्रुटि नहीं मिलती है।

+0

इसके अलावा: 'स्टैक ghci --test: spec' 'stack ghci --test chapterexercises के लिए शॉर्टेंड है: परीक्षण: spec' – dcastro

संबंधित मुद्दे