File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
1212// * line of comment
1313// * line without any quotes
1414// * line(s) with quoted strings, which are kept together to form a single "line of configuration"
15- var linesRe = regexp .MustCompile (`(\n|\s*// [^\n]*\n|[^'"\n]*\n|([^"'\n]*("(\\"|[^"])*"|'(\\'|[^'])*')[^"'\n]*)*\n)` )
15+ var linesRe = regexp .MustCompile (`(\n|\s*# [^\n]*\n|[^'"\n]*\n|([^"'\n]*("(\\"|[^"])*"|'(\\'|[^'])*')[^"'\n]*)*\n)` )
1616
1717func prefix (in string , emptyNewline bool ) string {
1818 if len (in ) == 0 {
Original file line number Diff line number Diff line change @@ -30,19 +30,19 @@ func TestPrefix(t *testing.T) {
3030 },
3131 {
3232 name : "simple attribute with comment" ,
33- input : `// comment
33+ input : `# comment
3434value => 3.1415
3535` ,
3636
3737 want : `
38- // comment
38+ # comment
3939 value => 3.1415
4040` ,
4141 },
4242 {
4343 name : "block" ,
4444 input : `add_field {
45- // comment
45+ # comment
4646 value => 3.1415
4747}
4848
@@ -51,7 +51,7 @@ add_tag => [ "foobar" ]
5151
5252 want : `
5353 add_field {
54- // comment
54+ # comment
5555 value => 3.1415
5656 }
5757
@@ -90,12 +90,12 @@ lines'
9090 },
9191 {
9292 name : "comment with double and single quote" ,
93- input : `// comment with " and '
93+ input : `# comment with " and '
9494othervalue => 3.1415
9595` ,
9696
9797 want : `
98- // comment with " and '
98+ # comment with " and '
9999 othervalue => 3.1415
100100` ,
101101 },
You can’t perform that action at this time.
0 commit comments