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

Add file and line numbers to the generated spec methods #4

Merged
merged 2 commits into from
Sep 25, 2020

Conversation

Blacksmoke16
Copy link
Member

@Blacksmoke16 Blacksmoke16 commented Sep 25, 2020

Add filename and line numbers to generated spec methods:

Before:

F*..F...F.......

Pending:
  ExampleSpec subtract

Failures:

  1) ExampleSpec add
     Failure/Error: @target.add(1, 2).should eq 4

       Expected: 4
            got: 3

     # spec/athena-spec_spec.cr:24

  2) DataProviderTest squares two
     Failure/Error: (value ** 2).should eq expected

       Expected: 5
            got: 4

     # spec/athena-spec_spec.cr:55

  3) DataProviderTest cubes 0
     Failure/Error: (value ** 3).should eq expected

       Expected: 9
            got: 8

     # spec/athena-spec_spec.cr:75

Finished in 334.79 milliseconds
16 examples, 3 failures, 0 errors, 1 pending

Failed examples:

crystal spec src/test_case.cr:256 # ExampleSpec add
crystal spec src/test_case.cr:256 # DataProviderTest squares two
crystal spec src/test_case.cr:256 # DataProviderTest cubes 0

After:

F*..F...F.......

Pending:
  ExampleSpec subtract

Failures:

  1) ExampleSpec add
     Failure/Error: @target.add(1, 2).should eq 4

       Expected: 4
            got: 3

     # spec/athena-spec_spec.cr:24

  2) DataProviderTest squares two
     Failure/Error: (value ** 2).should eq expected

       Expected: 5
            got: 4

     # spec/athena-spec_spec.cr:55

  3) DataProviderTest cubes 0
     Failure/Error: (value ** 3).should eq expected

       Expected: 9
            got: 8

     # spec/athena-spec_spec.cr:75

Finished in 329.93 milliseconds
16 examples, 3 failures, 0 errors, 1 pending

Failed examples:

crystal spec spec/athena-spec_spec.cr:23 # ExampleSpec add
crystal spec spec/athena-spec_spec.cr:54 # DataProviderTest squares two
crystal spec spec/athena-spec_spec.cr:74 # DataProviderTest cubes 0

The failure locations now correctly report the related test method.

@Blacksmoke16 Blacksmoke16 merged commit c183ce1 into master Sep 25, 2020
@Blacksmoke16 Blacksmoke16 deleted the spec-locations branch September 25, 2020 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant