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

pending test causes incorrect test count and malformed output #7192

Closed
leighmcculloch opened this issue Dec 16, 2018 · 4 comments
Closed

pending test causes incorrect test count and malformed output #7192

leighmcculloch opened this issue Dec 16, 2018 · 4 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:specs

Comments

@leighmcculloch
Copy link

Version of crystal:

Crystal 0.27.0 [c9d1eef8f] (2018-11-01)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu

When I mark a test as pending the count of tests and test output are malformed.

I wrote the following test.

describe "my tests" do
  it "1 equals 1.0" do
    1.should eq 1.0
  end
end

Running the test correctly outputs one green test displays the expected output.
screen shot 2018-12-16 at 8 24 31 am

When I mark the test as pending, things will get interesting.

describe "my tests" do
  it "1 equals 1.0" do
    pending "something"
    1.should eq 1.0
  end
end

The output shows two examples and the verbose output is malformed with the word something showing up twice on the first example listed and only 1.0 from the test name is shown, not the full name 1 equals 1.0.
screen shot 2018-12-16 at 8 23 49 am

The non-verbose spec output also shows two examples, although is not malformed.
screen shot 2018-12-16 at 8 25 30 am

@leighmcculloch leighmcculloch changed the title Bug: pending test pending test causes incorrect test count and malformed output Dec 16, 2018
@asterite
Copy link
Member

You should replace it with pending, not nest pending inside it.

@RX14
Copy link
Contributor

RX14 commented Dec 16, 2018

We could probably stop it inside it or similar, at runtime. But I think this issue should be closed. If anyone wants to implement the above, send a PR.

@RX14 RX14 closed this as completed Dec 16, 2018
@leighmcculloch
Copy link
Author

@RX14 Could we make it/pending undefined inside an it?

@asterite
Copy link
Member

@RX14 Definitely! That, and also disallowing it outside of describe, and also .should outside it. I think it's possible and it would be a great addition (I've been bitten by some of those in the past).

Let's keep this open to improve this situation.

@asterite asterite reopened this Dec 16, 2018
makenowjust added a commit to makenowjust/crystal that referenced this issue Dec 20, 2018
@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:specs labels Dec 30, 2018
makenowjust added a commit to makenowjust/crystal that referenced this issue Jan 11, 2019
makenowjust added a commit to makenowjust/crystal that referenced this issue Jan 11, 2019
Currently nesting `it`/`pending` doesn't break `crystal spec -v` output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:specs
Projects
None yet
Development

No branches or pull requests

4 participants