(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestEscapeFlags(t *testing.T) { |
| 10 | cases := []struct { |
| 11 | name string |
| 12 | input string |
| 13 | expected string |
| 14 | }{ |
| 15 | { |
| 16 | name: "empty string", |
| 17 | input: "", |
| 18 | expected: "", |
| 19 | }, |
| 20 | { |
| 21 | name: "basic single flag", |
| 22 | input: "use -flag to enable", |
| 23 | expected: "use `-flag` to enable", |
| 24 | }, |
| 25 | { |
| 26 | name: "double dash flag", |
| 27 | input: "use --long-flag-name to configure", |
| 28 | expected: "use `--long-flag-name` to configure", |
| 29 | }, |
| 30 | { |
| 31 | name: "multiple flags", |
| 32 | input: "use -a or --bee flags", |
| 33 | expected: "use `-a` or `--bee` flags", |
| 34 | }, |
| 35 | { |
| 36 | name: "should not match in-place", |
| 37 | input: "performs in-place modification", |
| 38 | expected: "performs in-place modification", |
| 39 | }, |
| 40 | { |
| 41 | name: "flags with numbers and hyphens", |
| 42 | input: "use --http2-max-streams or -h2-timeout", |
| 43 | expected: "use `--http2-max-streams` or `-h2-timeout`", |
| 44 | }, |
| 45 | { |
| 46 | name: "flag at start of string", |
| 47 | input: "-flag at start", |
| 48 | expected: "`-flag` at start", |
| 49 | }, |
| 50 | { |
| 51 | name: "existing backticks", |
| 52 | input: "use `--existing` and -new flags", |
| 53 | expected: "use `--existing` and `-new` flags", |
| 54 | }, |
| 55 | { |
| 56 | name: "multiple spaces before flag", |
| 57 | input: "test -flag with spaces", |
| 58 | expected: "test `-flag` with spaces", |
| 59 | }, |
| 60 | { |
| 61 | name: "mixed valid and invalid patterns", |
| 62 | input: "test in-place and -valid --flags", |
| 63 | expected: "test in-place and `-valid` `--flags`", |
| 64 | }, |
| 65 | { |
| 66 | name: "separator line", |
nothing calls this directly
no test coverage detected