test(processor): preservation, preserve-lines, backup cases
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
|||||||
|
x := 1 // TODO: fix
|
||||||
|
y := 2 // remove me
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
x := 1 // TODO: fix
|
||||||
|
y := 2
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
a := 1 // this is IMPORTANT stuff
|
||||||
|
b := 2 // trivial
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
a := 1 // this is IMPORTANT stuff
|
||||||
|
b := 2
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
# gone
|
||||||
|
keep = 1
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
keep = 1
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
x = 1
|
||||||
|
# indented comment
|
||||||
|
y = 2
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
x = 1
|
||||||
|
|
||||||
|
y = 2
|
||||||
@@ -101,6 +101,13 @@ func TestWholeFile(t *testing.T) {
|
|||||||
{name: "multiple single-line blocks on one line", file: "c_multiblock.c"},
|
{name: "multiple single-line blocks on one line", file: "c_multiblock.c"},
|
||||||
{name: "--inline removes only line comments", file: "js_inline_flag.js", cli: types.CLI{Inline: true}},
|
{name: "--inline removes only line comments", file: "js_inline_flag.js", cli: types.CLI{Inline: true}},
|
||||||
{name: "--block removes only block comments", file: "js_block_flag.js", cli: types.CLI{Block: true}},
|
{name: "--block removes only block comments", file: "js_block_flag.js", cli: types.CLI{Block: true}},
|
||||||
|
{name: "preserve exact pattern TODO", file: "go_preserve.go"},
|
||||||
|
{name: "preserve wildcard IMPORTANT", file: "go_wildcard.go",
|
||||||
|
cfg: &config.Config{Preserve: []string{"*IMPORTANT*"}, ContextLines: 3}},
|
||||||
|
{name: "--preserve-lines keeps comment-only line as blank", file: "py_preserve_lines.py",
|
||||||
|
cli: types.CLI{PreserveLines: true}},
|
||||||
|
{name: "--backup writes .bak of original", file: "py_backup.py",
|
||||||
|
cli: types.CLI{Backup: true}, wantBackup: true},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|||||||
Reference in New Issue
Block a user