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

cabal test fails the second time #90

Closed
gelisam opened this issue Feb 2, 2014 · 10 comments
Closed

cabal test fails the second time #90

gelisam opened this issue Feb 2, 2014 · 10 comments
Assignees
Labels
Milestone

Comments

@gelisam
Copy link
Owner

gelisam commented Feb 2, 2014

Because the first pass creates fakedir, so for the second pass, it's no longer a non-existing folder.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

Ever since I fixed #87, it fails the first time too :)

It's because #87 now creates the context directory without emitting a warning.

@ghost ghost assigned gelisam Feb 2, 2014
@melrief
Copy link
Collaborator

melrief commented Feb 2, 2014

I don't see how: checkContextDir must emit the warning if the directory doesn't exist. Maybe we should remove any directory called fakedir before starting the test else the test will already find the directory? Or use a temporary filename as fake directory so that it cannot exist?

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

I don't see how: checkContextDir must emit the warning if the directory doesn't exist.

Because I removed the call to checkContextDir in da5b015. I'll add it somewhere else.

Maybe we should remove any directory called fakedir before starting the test else the test will already find the directory?

I was planning to remove it after the test instead of before.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

Branch issue-90.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

I guess I should explain why I removed it in the first place.

I want processSpec and processArgs to have the same behaviour. If we check and create the context folder inside parseArgs, then processSpec will not also check and create the context folder, adding a burden to the users of processSpec (currently, that's just tests, but we might like to expose Hawk as a library someday).

The reason OptionParser uses Uncertain is so that warnings and errors may be raised while conversion from [String] to HawkSpec. When you suggested it, I thought it was a good idea to check whether the files passed as argument as readable or writable, but when I saw that you were also creating the folder, that raised a red flag. And now I no longer think we should check that the argument is readable or writable, only that the String is a proper FilePath.

@melrief
Copy link
Collaborator

melrief commented Feb 2, 2014

Ok, but I still think we should exit with the right error when the context directory hasn't the right permissions. IOExceptions on reading files can be problematic for the user, I think it is better to print a clean error when some IO actions doesn't work as expected. That's why I have done the check in that way.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

I agree. Let's add checkContextDir back, but somewhere inside processSpec this time.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

Since the test is explicitly checking that the parser is raising the warning, and we no longer want the parser to raise that warning, I have simply removed the part of the test which checks for the warning.

I guess we'll have to wait for #26 in order to properly test that the warning is emitted.

@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

Merged into develop, closing.

@gelisam gelisam closed this as completed Feb 2, 2014
gelisam added a commit that referenced this issue Feb 2, 2014
@gelisam
Copy link
Owner Author

gelisam commented Feb 2, 2014

Forgot the last commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants