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

Ignore duplicate words in example test output #41

Conversation

matthewhughes934
Copy link
Contributor

It's common that output is repeated in these examples, e.g.[1], so add an exception for these in test files when detecting duplicates.

Even though the docs[2] only mention "// Output:" and "// Unordered output:" the lower case version of these also seems supported (see again[1]).

[1] https://go.googlesource.com/go/+/f38d42f2c4c6ad0d7cbdad5e1417cac3be2a5dcb/src/bytes/example_test.go#58
[2] https://pkg.go.dev/testing#hdr-Examples

Issue: #20

It's common that output is repeated in these examples, e.g.[1], so add
an exception for these in test files when detecting duplicates.

Even though the docs[2] only mention "// Output:" and "// Unordered
output:" the lower case version of these also seems supported (see
again[1]).

[1] https://go.googlesource.com/go/+/f38d42f2c4c6ad0d7cbdad5e1417cac3be2a5dcb/src/bytes/example_test.go#58
[2] https://pkg.go.dev/testing#hdr-Examples
@Abirdcfly Abirdcfly merged commit e418fc6 into Abirdcfly:main Aug 22, 2024
2 checks passed
@Abirdcfly
Copy link
Owner

Thanks @matthewhughes934!

@matthewhughes934 matthewhughes934 deleted the mhughes-ignore-duplicates-in-example-test-output branch August 22, 2024 02:25
@mitar
Copy link

mitar commented Sep 2, 2024

Awesome! Can you please also add // Example output: to the list of allowed prefixes? I am using that when having a non-deterministic output from the example (then you cannot run it, but it is still useful to show what the output looks like).

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.

3 participants