Skip to content

Commit

Permalink
test case for comments in OCaml strings, #701
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Dec 16, 2022
1 parent 7852da0 commit 7c4a3a4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -9512,6 +9512,7 @@ sub set_constants { # {{{1
[ 'call_regexp_common' , 'C++' ],
],
'OCaml' => [
[ 'rm_comments_in_strings', '"', '(*', '*)', 1 ],
[ 'remove_OCaml_comments', ],
],
'OpenCL' => [
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 @@ -683,6 +683,13 @@ my @Tests = (
'ref' => '../tests/outputs/issues/692/results.yaml',
},

{
'name' => 'comments in OCaml strings, #701',
'cd' => '../tests/inputs/issues/701',
'args' => '--strip-str-comments demo.ml',
'ref' => '../tests/outputs/issues/701/results.yaml',
},

);

# Special cases:
Expand Down
8 changes: 8 additions & 0 deletions tests/inputs/issues/701/demo.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let just_a_string = "
(*
"
let x = 0
let also_a_string = "
*)
"
let y = x
21 changes: 21 additions & 0 deletions tests/outputs/issues/701/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 : 1.95
elapsed_seconds : 0.00726699829101562
n_files : 1
n_lines : 8
files_per_second : 137.608398950131
lines_per_second : 1100.86719160105
report_file : ../../../outputs/issues/701/results.yaml
'OCaml' :
nFiles: 1
blank: 0
comment: 0
code: 8
SUM:
blank: 0
comment: 0
code: 8
nFiles: 1

0 comments on commit 7c4a3a4

Please sign in to comment.