Skip to content

Check the right kind of error is thrown in tests#1323

Merged
paf31 merged 7 commits intopurescript:masterfrom
hdgarrood:should-fail-with
Aug 3, 2015
Merged

Check the right kind of error is thrown in tests#1323
paf31 merged 7 commits intopurescript:masterfrom
hdgarrood:should-fail-with

Conversation

@hdgarrood
Copy link
Copy Markdown
Contributor

Add a basic mechanism for declaring what kind of errors a test should
throw, and add a few of these declarations to failing examples.

If you think this looks good I'll go ahead and add these declarations to all of the failing examples.

Refs (possibly fixes?) #1181

Add a basic mechanism for declaring what kind of errors a test should
throw, and add a few of these declarations to failing examples.
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 2, 2015

Looks fantastic, thank you! Once we have all tests marked up, perhaps it makes sense to use the lack of an annotation to mean "should pass"?

@michaelficarra
Copy link
Copy Markdown
Contributor

@hdgarrood Can you show some examples of multiple errors or compilation errors?

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Once we have all tests marked up, perhaps it makes sense to use the lack of an annotation to mean "should pass"?

I'm not sure, we do already have a way of indicating this based on what directory the file is in; that is, passing vs failing. I do think it would be a good idea to make sure that every failing test does fail with a specific error though; perhaps a good way to achieve this would be to require that every test inside the failing directory has at least one shouldFailWith declaration?

Can you show some examples of multiple errors or compilation errors?

I've put 3 examples in already, I'm going to start going through and adding more now. Come to think of it I'm not sure if there are any that should produce more than 1 error, we'll see in a moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelficarra Here's an example with a test raising multiple errors.

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Quite a few of these no longer testing what they are supposed to test since 0.7! I think this is all good now, though.

@hdgarrood
Copy link
Copy Markdown
Contributor Author

Also, some next steps from here:

  • add tests for suggestions (I think we should have a real data type for suggestions too, not just strings).
  • add tests for warnings
  • work out how to run all the tests in the manual directory automatically. Perhaps the shouldFailWith mechanism is enough, but we can presumably also embed specific examples inside the Haskell source if we need a more elaborate check.

paf31 added a commit that referenced this pull request Aug 3, 2015
Check the right kind of error is thrown in tests
@paf31 paf31 merged commit 464af8e into purescript:master Aug 3, 2015
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Aug 3, 2015

Brilliant! I've wanted this for so long and never got round to implementing it. Thanks!

@hdgarrood hdgarrood deleted the should-fail-with branch December 29, 2015 11:32
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

Successfully merging this pull request may close these issues.

3 participants