-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Code coverage support #154
Conversation
This appears to be a bit tricky since this implementation processes all files as single awk source and does some validations (like making sure functions are defined). This is a problem if we want to annotate on per-file basis, since we need to parse files separately.
This appears to be a bit tricky since this implementation processes all files as single awk source and does some validations (like making sure functions are defined). This is a problem if we want to annotate on per-file basis, since we need to parse files separately.
This appears to be a dead end... This reverts commit 3a3a6c2. Revert "Work on annotating multiple files (multiple -f provided)." This reverts commit fb42783. Revert "Work on annotating multiple files (multiple -f provided)." This reverts commit 5dbafa3. Revert "Work on annotating multiple files (multiple -f provided)." This reverts commit bb09b88. Revert "Work on annotating multiple files (multiple -f provided)." This reverts commit 3e0c70b.
Actually I managed to fix tests for windows. Still there is problem with macOS. |
Thanks! I'll do the final review later today. It looks like the macOS tests are failing, not because of this PR, but because homebrew |
Conflicts: - goawk.go
FYI, I resolve the merge conflicts after merging #155. |
Yeah, I think we should add a few basic tests for the |
Actually, I just opened an issue to track that: #156 |
This is great, thank you. Just a couple of nit comments above, and then I'll merge this in. Looking forward to playing with AWK coverage! :-) |
…clude the leading hyphen: `"-covermode can only be one of: set, count"`
Hopefully, done. |
One more PR for #144 that addresses couple of minor things, missed in #154 In this PR: 1. Remove unintuitive behavior (outputting annotated code when only `-covermode` flag set) - just use `-d` flag 2. Update cover.png screenshot: now we show if/for/while conditions in green (covered) 3. Fix for `./goawk -covermode=set 'BEGIN { print 123 }'` to not hang waiting for stdin. This started to happen because processing stops if `prog.Actions == nil` and we by mistake were changing it to empty slice during coverage annotation.
This PR implements #144 and tries to address all CR notes in #144 (comment).
This PR is based on top of previous related PRs #148, #153 in order to eliminate the necessity for different hacky solutions.
I think code-wise this is ready. The only thing I still want to add - a documentation in own file
coverage.md
. While I'm working on this I would be really glad if you @benhoyt check the current implementation in this PR. Hopefully now it should be in much better shape than with prevous hacky approach.