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

Improve test suite #38

Open
josefs opened this issue Oct 3, 2018 · 6 comments
Open

Improve test suite #38

josefs opened this issue Oct 3, 2018 · 6 comments

Comments

@josefs
Copy link
Owner

josefs commented Oct 3, 2018

We have a reasonably good test suite with a lot of unit tests and a few test programs. It's very helpful and I use it all the time. But sadly, there are many cases that are not covered by the test suite. We can make it even more helpful! It'd be wonderful if people wanted to help out with this. It's also a very easy way to help out this project. I'm happy to assist anyone who wants to make a contribution.

@zuiderkwast
Copy link
Collaborator

It is possible to generet a code coverage report with make tests COVER=1 if I remember correctly. (I implemented that in erlang.mk some years ago.)

@josefs
Copy link
Owner Author

josefs commented Oct 4, 2018

SWEET! That's super useful @zuiderkwast!

For posterity I just want to say that the coverage report can be found in cover/index.html after running make tests COVER=1.

@Zalastax
Copy link
Collaborator

Zalastax commented Nov 1, 2018

How do I know what tests need to be written? It's tricky to look at the coverage report and figure out what will cause flow to reach each branch. Is it a better idea to pick a big corpus of code and type check that and then minimize each failing case?

@zuiderkwast
Copy link
Collaborator

I think it should be pretty strait-forward to come up with a test case for most of the uncovered lines. Most functions are helper functions for either the subtyping relation, for type_check_expr (type inference/propagation) or for type_check_expr_in (typechecking against a known type). Basically every erlang expression can exist in a context where we expect a certain type (e.g. a function with a spec) and in a context where we don't.

If some code is really hard to understand why it is there, perhaps it shouldn't be there or it needs some renaming or explanation in comments. Post a comment on any part of the code and I'll be happy to try to answer.

@NelsonVides
Copy link
Contributor

make tests COVER=1 doesn't do anything since a long time. For a while, rebar3 cover was making the pretty html files, but now after the strong cut away from rebar, make cover produces only the coverage.xml file, which is not very human readable.

rebar3 do eunit -c, cover works for now, and the files this generates are correctly gitignored.

@zuiderkwast
Copy link
Collaborator

I think there are plain text cover files generated under cover/. If you need the html files, we can just add an option to generate them in the Makefile. Also, if you don't want to download the covertool to generate the xml file, we can make that a separate target, so that make cover only produces the html and/or text files.

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

No branches or pull requests

4 participants