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

Reverse "want" and "got" in test failures #279

Merged
merged 2 commits into from
Aug 11, 2022

Conversation

lutzky
Copy link
Contributor

@lutzky lutzky commented Aug 10, 2022

Suppose we have a rule configured to label messages with oops-bad-label, and a test that checks they're labeled with yep-correct-label. So before this change you would get:

--- want
+++ got
...
  "labels": [
-   "oops-bad-label"
+   "yep-correct-label"
  ]

To make this match the usual logic of automated testing (especially Go's "want" and "got"), we would like the "want" section to be "what the test describes should happen". Therefore, with this change, we get this output:

--- want
+++ got
...
  "labels": [
-   "yep-correct-label"
+   "oops-bad-label"
  ]

@mbrt
Copy link
Owner

mbrt commented Aug 10, 2022

Uhm, you're right! I never realized the test was the opposite.

@lutzky
Copy link
Contributor Author

lutzky commented Aug 10, 2022

The failure (seen here) is unrelated to this commit... but it prevents tests from running. Would you like a separate PR to fix that?

@mbrt
Copy link
Owner

mbrt commented Aug 11, 2022

Ah yes, please. If you have a minute this would be helpful.

Suppose we have a rule configured to label messages with
"oops-bad-label", and a test that checks they're labeled with
"yep-correct-label". So before this change you would get:

    --- want
    +++ got
    ...
      "labels": [
    -   "oops-bad-label"
    +   "yep-correct-label"
      ]

To make this match the usual logic of automated testing (especially Go's
"want" and "got"), we would like the "want" section to be "what the test
describes should happen". Therefore, with this change, we get this
output:

    --- want
    +++ got
    ...
      "labels": [
    -   "yep-correct-label"
    +   "oops-bad-label"
      ]
@lutzky
Copy link
Contributor Author

lutzky commented Aug 11, 2022

I've done it as a separate commit within this PR, LMK if you want it in a separate PR.

@mbrt
Copy link
Owner

mbrt commented Aug 11, 2022

That's totally fine. Thanks a lot!

@mbrt mbrt merged commit a05e2a0 into mbrt:master Aug 11, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants