Crystal: pending test causes incorrect test count and malformed output

Created on 16 Dec 2018  路  4Comments  路  Source: crystal-lang/crystal

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

bug topicspecs

Most helpful comment

@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.

All 4 comments

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

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 Could we make it/pending undefined inside an it?

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

costajob picture costajob  路  3Comments

relonger picture relonger  路  3Comments

oprypin picture oprypin  路  3Comments

cjgajard picture cjgajard  路  3Comments

asterite picture asterite  路  3Comments