test(processor): preservation, preserve-lines, backup cases

This commit is contained in:
2026-07-02 09:20:06 -05:00
parent 42c46aa2d5
commit a117f75bba
9 changed files with 24 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
x := 1 // TODO: fix
y := 2 // remove me
+2
View File
@@ -0,0 +1,2 @@
x := 1 // TODO: fix
y := 2
+2
View File
@@ -0,0 +1,2 @@
a := 1 // this is IMPORTANT stuff
b := 2 // trivial
+2
View File
@@ -0,0 +1,2 @@
a := 1 // this is IMPORTANT stuff
b := 2
+2
View File
@@ -0,0 +1,2 @@
# gone
keep = 1
+1
View File
@@ -0,0 +1 @@
keep = 1
+3
View File
@@ -0,0 +1,3 @@
x = 1
# indented comment
y = 2
@@ -0,0 +1,3 @@
x = 1
y = 2
+7
View File
@@ -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 {