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

Given blocks which create an empty buffer do not get a line in the output window #207

Open
deoxys314 opened this issue Apr 16, 2020 · 1 comment

Comments

@deoxys314
Copy link

I'm testing a plugin which (usually) operates on empty buffers. Given blocks with some content to be placed in the buffer have a line entry in the optput window, as epxected, e.g. (1/2) [ GIVEN] A buffer with some content. However, if I have a Given block without any content in the buffer, then no output appears. Other behavior is still correct - the tests, (which mostly involve reading in text to the empty buffer) work correctly. But this breaks up the flow of reading the tests like a semi-sentence, which I believe is part of the design goal of frameworks such as this.

This is low priority, as it doesn't actually effect the testing regime. And being as we all seem to have a lot of free time these days, it's possible I'll submit a PR for this myself.

Minimal vader file for reproduction below.

# Buffer with content behaves as expected
Given (A buffer with some content):
  Text

Do (Nothing):

Expect (No change):
  Text

# Buffer with no content does not have messaging
Given (An empty buffer):

Do (Nothing):

Expect (No content):
  

Note that the last line has 2 spaces, telling the Expect block to look for a blank line.

@deoxys314
Copy link
Author

This seems to be desired behavior, being as there is a specific check for this here:

if !empty(given)

Possibly a solution would be to instead check if !empty(given) || !empty(comment.given)? Empty Given blocks are of course possible when they are omitted, but if there is an empty one with a comment it seems likely to be intentional by the test author.

I've not done tests in vader (very oroburos), but a quick proof of concept make it seems to me like that works. I'll put together a test file at some point, and submit my PR.

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

1 participant