Skip to content

Commit

Permalink
Don`t check test example comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krivak committed Aug 19, 2023
1 parent e366a23 commit a43fe64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ func isSpecialBlock(comment string) bool {
strings.Contains(comment, "#define")) {
return true
}
if strings.HasPrefix(comment, "// Output: ") {

This comment has been minimized.

Copy link
@mitar

mitar Sep 9, 2023

Hm, should this be based on the function name and file name (so starts with Example in _test.go file)? I think that would be much better.

This comment has been minimized.

Copy link
@tetafro

tetafro Sep 17, 2023

Owner

Yep, it definitely would.
The problem is that getting function name is quite hard and requires some kind of manual parsing. I currently use this, which returns just text and position in file.
Getting filename is easier, but even this would require a lot of changes in code - to have the filename as an argument everywhere in checks. While I try to keep it simple and use just text wherever possible.

So, overall - a lot of changes just for one small check. I'll probably won't do it, at least for now.

return true
}
return false
}

Expand Down
5 changes: 5 additions & 0 deletions checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ func TestIsSpecialBlock(t *testing.T) {
*/`,
isSpecial: true,
},
{
name: "Test output",
comment: "// Output: true",
isSpecial: true,
},
}

for _, tt := range testCases {
Expand Down

0 comments on commit a43fe64

Please sign in to comment.