Skip to content

Commit

Permalink
"*/*", */* in Go strings, #816
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Mar 15, 2024
1 parent 2284b8c commit 84d7457
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -9715,6 +9715,7 @@ sub set_constants { # {{{1
],
'Go' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '["`]', '*/*', '' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
[ 'remove_inline' , '//.*$' ],
Expand Down
7 changes: 7 additions & 0 deletions Unix/t/01_opts.t
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,13 @@ my @Tests = (
'ref' => '../tests/outputs/issues/811/inline_comment.xml.yaml',
},

{
'name' => '"*/*", `*/*` in Go strings #816',
'cd' => '../tests/inputs/issues/816',
'args' => '--strip-str-comments star_slash_star.go',
'ref' => '../tests/outputs/issues/816/results.yaml',
},

);

# Special cases:
Expand Down
1 change: 1 addition & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -9730,6 +9730,7 @@ sub set_constants { # {{{1
],
'Go' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '["`]', '*/*', '' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
[ 'remove_inline' , '//.*$' ],
Expand Down
13 changes: 13 additions & 0 deletions tests/inputs/issues/816/star_slash_star.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
foo: = "*/*"
a: = 10
b: = 20
foo: = "*/*"

/*
a comment
*/

foo: = `*/*`
a: = 10
b: = 20
foo: = `*/*`
21 changes: 21 additions & 0 deletions tests/outputs/issues/816/results.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 2.01
elapsed_seconds : 0.00281190872192383
n_files : 1
n_lines : 13
files_per_second : 355.63032050195
lines_per_second : 4623.19416652535
report_file : ../../../outputs/issues/816/results.yaml
'Go' :
nFiles: 1
blank: 2
comment: 3
code: 8
SUM:
blank: 2
comment: 3
code: 8
nFiles: 1

0 comments on commit 84d7457

Please sign in to comment.