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

isbn_verifier task: run each test dataset in a separate TC #2247

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

anton-ptashnik
Copy link
Contributor

@anton-ptashnik anton-ptashnik commented Jun 10, 2022

Refers to: #2098

Fixes:

  • made each dataset execute in a separate TC
    It allows IDEs to differentiate test runs with different data. VS Code as an example below.
  • removed PASS logs so only fails are displayed on go test

Before

  • CLI output
PS C:\Users\iavto\Documents\go\isbn-verifier> go test
--- FAIL: TestIsValidISBN (0.00s)
    isbn_verifier_test.go:25: FAIL: valid isbn number
        IsValidISBN("3-598-21508-8")
        Expected: true, Actual: false
    isbn_verifier_test.go:23: PASS: invalid isbn check digit
    isbn_verifier_test.go:23: PASS: valid isbn number with a check digit of 10
    isbn_verifier_test.go:23: PASS: check digit is a character other than X   
    isbn_verifier_test.go:23: PASS: invalid character in isbn
    isbn_verifier_test.go:23: PASS: X is only valid as a check digit
    isbn_verifier_test.go:25: FAIL: valid isbn without separating dashes      
        IsValidISBN("3598215088")
        Expected: true, Actual: false
    isbn_verifier_test.go:23: PASS: isbn without separating dashes and X as check digit
    isbn_verifier_test.go:23: PASS: isbn without check digit and dashes
    isbn_verifier_test.go:23: PASS: too long isbn and no dashes
    isbn_verifier_test.go:23: PASS: too short isbn
    isbn_verifier_test.go:23: PASS: isbn without check digit
    isbn_verifier_test.go:23: PASS: check digit of X should not be used for 0
    isbn_verifier_test.go:23: PASS: empty isbn
    isbn_verifier_test.go:23: PASS: input is 9 characters
    isbn_verifier_test.go:23: PASS: invalid characters are not ignored
    isbn_verifier_test.go:23: PASS: input is too long but contains a valid isbn
FAIL
exit status 1
FAIL    isbn    0.485s
  • VS Code (no dataset visibility)

image

After

  • CLI output
PS C:\Users\iavto\Documents\go\isbn-verifier> go test
--- FAIL: TestIsValidISBN (0.00s)
    --- FAIL: TestIsValidISBN/valid_isbn_number (0.00s)
        isbn_verifier_test.go:12: IsValidISBN("3-598-21508-8")
            Expected: true, Actual: false
    --- FAIL: TestIsValidISBN/valid_isbn_without_separating_dashes (0.00s)
        isbn_verifier_test.go:12: IsValidISBN("3598215088")
            Expected: true, Actual: false
FAIL
exit status 1
FAIL    isbn    0.574s
  • VS Code

image

@github-actions
Copy link
Contributor

Dear iAutomator

Thank you for contributing to the Go track on Exercism! 💙
You will see some automated feedback below 🤖. It would be great if you can make sure your PR covers those points. This will save your reviewer some time and your change can be merged quicker.

  • ⬆️ The instructions and test cases for many practice exercises originate in the Exercism-wide problem-specifications repo. If the exercise you changed is listed there in the exercises folder, please consider the following.

    • Improvements to the instructions.md file should be made in the problem-spec repo so that all tracks can benefit.
      You can open a PR there instead.
    • If you want to add some language specific information, use the instructions.append.md file (see Practice Exercise Docs).
    • Test cases selected in the .meta/tests.toml file need to be implemented in the <exercise>_test.go file according to the specification in canonical-data.json.
  • ✍️ If your PR is not related to an existing issue (and is not self-explaining like a typo fix), please make sure the description explains why the change you made is necessary.

  • 🔤 If your PR fixes an easy to identify typo, if would be great if you could check for that typo in the whole repo. For example, if you found Unicdoe, use "replace all" in your editor (or command line magic) to fix it consistently.

Dear Reviewer/Maintainer

  • 📏 Make sure you set the appropriate x:size label for the PR. (This also works after merging, in case you forgot about it.)

  • 🔍 Don't be too nit-picky. If the PR is a clear improvement compared to the status quo, it should be approved as clear signal this is good to be merged even if the minor comments you might have are not addressed by the contributor. Further improvement ideas can be captured in issues (if important enough) and implemented via additional PRs.

  • 🤔 After reviewing the diff in the "Files changed" section, take a moment to think about whether there are changes missing from the diff. Does something need to be adjusted in other places so the code or content stays consistent?

Automated comment created by PR Commenter 🤖.

@junedev
Copy link
Member

junedev commented Jun 10, 2022

@andrerfcsantos I saw lots of other exercises that also have the PASS entry logged and that are not using subtests properly. Do you know whether that file that is changed in this PR is also related to the generator or whether it is written manually and only the test cases are generated?

Copy link
Member

@andrerfcsantos andrerfcsantos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@junedev The test generator only touches cases_test.go, so it's fine to change this file manually.

Thanks @iAutomator, this is great!

@andrerfcsantos andrerfcsantos added the x:size/small Small amount of work label Jun 10, 2022
@andrerfcsantos andrerfcsantos merged commit fa51adb into exercism:main Jun 10, 2022
@anton-ptashnik anton-ptashnik deleted the isbn-tc-per-dataset branch June 11, 2022 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/small Small amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants