Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create folder structure appropriate for testing #3

Open
Sword-Smith opened this issue May 14, 2016 · 3 comments
Open

Create folder structure appropriate for testing #3

Sword-Smith opened this issue May 14, 2016 · 3 comments

Comments

@Sword-Smith
Copy link
Owner

Troels: Can you make a folder structure which is appropriate for testing? I would like to run unit tests on various function in the different modules located in src/ but when I create test modules in T/, I cannot get those modules to import the modules found in src/

@Sword-Smith Sword-Smith assigned Sword-Smith and athas and unassigned Sword-Smith May 14, 2016
@Sword-Smith
Copy link
Owner Author

Sword-Smith commented May 14, 2016

On a clear install of this program using stack, I wrote a test module in T/RegAllocTest.hs and executed ghci T/RegAllocTest.hs from both the root folder and from the T/ folder. This resulted in the following error message:

GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help

T/RegAllocTest.hs:3:8:
    Could not find module ‘MipsRegAlloc’
    Use -v to see a list of the files searched for.

T/RegAllocTest.hs:4:8:
    Could not find module ‘Mips’
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.

@Sword-Smith
Copy link
Owner Author

I was able to fix the importation of modules located in src/ to files located in T/. This was fixed by adding a .ghci file in the root folder containing the text

:set -isrc

Is this the correct way to handle this or should stack somehow be used?

@athas
Copy link
Collaborator

athas commented May 14, 2016

The right way is to use Cabal's support for test suites. I'll create a skeleton.

(I'll also do something more interesting soon.)

athas added a commit that referenced this issue May 14, 2016
Run 'stack test' to execute it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants