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 test for WithVersion option #8

Merged
merged 3 commits into from
Mar 7, 2024
Merged

Add test for WithVersion option #8

merged 3 commits into from
Mar 7, 2024

Conversation

mfridman
Copy link
Member

@mfridman mfridman commented Mar 7, 2024

A quick test to make sure we exercise the RunOption and WithVersion code path.

┌───────────────────────────────────────────────────────────────────────────────────┐
│  STATUS │ ELAPSED │             PACKAGE             │ COVER │ PASS │ FAIL │ SKIP  │
│─────────┼─────────┼─────────────────────────────────┼───────┼──────┼──────┼───────│
│  PASS   │  1.25s  │ github.com/bufbuild/protoplugin │ 39.6% │  2   │  0   │  0    │
└───────────────────────────────────────────────────────────────────────────────────┘


_, err := run([]string{"--unsupported"})
require.Error(t, err)
require.Contains(t, err.Error(), "unknown argument")
Copy link
Member

Choose a reason for hiding this comment

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

We should make a private unknownArgumentsError that takes a string slice, prints out the conditional plural depending on length of args, and do errors.Is here, just to get in habit of not testing error strings in this package while it's still greenfield

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, updated in 9f4f65c.

protoplugin.go Outdated
args []string
}

func newUnknownArgumentsError(arguments []string) error {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: would name param "args"

@mfridman mfridman merged commit 43fa23a into main Mar 7, 2024
4 checks passed
@mfridman mfridman deleted the mf-tests branch March 7, 2024 13:21
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