(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func Test_applyPatterns_errors(t *testing.T) { |
| 104 | cases := []struct { |
| 105 | description string |
| 106 | conf core.Config |
| 107 | exts extensionConfig |
| 108 | content string |
| 109 | expectedErr string |
| 110 | }{ |
| 111 | { |
| 112 | description: "only one delimiter", |
| 113 | conf: core.Config{ |
| 114 | CommentDelimiters: map[string][2]string{ |
| 115 | ".md": {"{/*", ""}, |
| 116 | }, |
| 117 | }, |
| 118 | exts: extensionConfig{".md", ".md"}, |
| 119 | content: ` |
| 120 | This is the intro pagragraph. |
| 121 | |
| 122 | {/* This is a comment */} |
| 123 | `, |
| 124 | expectedErr: "", |
| 125 | }, |
| 126 | } |
| 127 | for _, c := range cases { |
| 128 | t.Run(c.description, func(t *testing.T) { |
| 129 | _, err := applyPatterns(&c.conf, c.exts, c.content) |
| 130 | if !strings.Contains(err.Error(), c.expectedErr) { |
| 131 | t.Fatalf("Expected '%s', but got '%s'", c.expectedErr, err.Error()) |
| 132 | } |
| 133 | }) |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // TODO: Test for expected errors resulting from applyPatterns |
nothing calls this directly
no test coverage detected
searching dependent graphs…