(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func Test_applyPatterns(t *testing.T) { |
| 11 | cases := []struct { |
| 12 | description string |
| 13 | conf core.Config |
| 14 | exts extensionConfig |
| 15 | content string |
| 16 | expected string |
| 17 | }{ |
| 18 | { |
| 19 | description: "MDX comment in markdown, custom comment delimiter", |
| 20 | conf: core.Config{ |
| 21 | CommentDelimiters: map[string][2]string{ |
| 22 | ".md": {"{/*", "*/}"}, |
| 23 | }, |
| 24 | }, |
| 25 | exts: extensionConfig{".md", ".md"}, |
| 26 | content: ` |
| 27 | This is the intro pagragraph. |
| 28 | |
| 29 | {/* This is a comment */} |
| 30 | `, |
| 31 | expected: strings.ReplaceAll(` |
| 32 | This is the intro pagragraph. |
| 33 | |
| 34 | <!-- This is a comment --> |
| 35 | `, "@", "`"), |
| 36 | }, |
| 37 | { |
| 38 | description: "MDX comment in markdown, no custom comment delimiter", |
| 39 | conf: core.Config{}, |
| 40 | exts: extensionConfig{".md", ".md"}, |
| 41 | content: ` |
| 42 | This is the intro pagragraph. |
| 43 | |
| 44 | {/* This is a comment */} |
| 45 | `, |
| 46 | expected: strings.ReplaceAll(` |
| 47 | This is the intro pagragraph. |
| 48 | |
| 49 | {/* This is a comment */} |
| 50 | `, "@", "`"), |
| 51 | }, |
| 52 | { |
| 53 | description: "multiline MDX comment in markdown, custom comment delimiter", |
| 54 | conf: core.Config{ |
| 55 | CommentDelimiters: map[string][2]string{ |
| 56 | ".md": {"{/*", "*/}"}, |
| 57 | }, |
| 58 | }, |
| 59 | exts: extensionConfig{".md", ".md"}, |
| 60 | content: ` |
| 61 | This is the intro pagragraph. |
| 62 | |
| 63 | {/* |
| 64 | This is a comment |
| 65 | */} |
| 66 | `, |
| 67 | expected: strings.ReplaceAll(` |
nothing calls this directly
no test coverage detected
searching dependent graphs…