@@ -6,8 +6,7 @@ import XCTest
6
6
class DefaultRawSuggestionPostProcessingStrategyTests : XCTestCase {
7
7
func test_whenSuggestionHasCodeTagAtTheFirstLine_shouldExtractCodeInside( ) {
8
8
let strategy = DefaultRawSuggestionPostProcessingStrategy (
9
- openingCodeTag: " <Code> " ,
10
- closingCodeTag: " </Code> "
9
+ codeWrappingTags: ( " <Code> " , " </Code> " )
11
10
)
12
11
let result = strategy. extractSuggestion (
13
12
from: """
@@ -21,8 +20,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
21
20
func test_whenSuggestionHasCodeTagAtTheFirstLine_closingTagInOtherLines_shouldExtractCodeInside(
22
21
) {
23
22
let strategy = DefaultRawSuggestionPostProcessingStrategy (
24
- openingCodeTag: " <Code> " ,
25
- closingCodeTag: " </Code> "
23
+ codeWrappingTags: ( " <Code> " , " </Code> " )
26
24
)
27
25
let result = strategy. extractSuggestion (
28
26
from: """
@@ -36,8 +34,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
36
34
37
35
func test_whenSuggestionHasCodeTag_butNoClosingTag_shouldExtractCodeAfterTheTag( ) {
38
36
let strategy = DefaultRawSuggestionPostProcessingStrategy (
39
- openingCodeTag: " <Code> " ,
40
- closingCodeTag: " </Code> "
37
+ codeWrappingTags: ( " <Code> " , " </Code> " )
41
38
)
42
39
let result = strategy. extractSuggestion (
43
40
from: """
@@ -51,8 +48,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
51
48
52
49
func test_whenMultipleOpeningTagFound_shouldTreatTheNextOneAsClosing( ) {
53
50
let strategy = DefaultRawSuggestionPostProcessingStrategy (
54
- openingCodeTag: " <Code> " ,
55
- closingCodeTag: " </Code> "
51
+ codeWrappingTags: ( " <Code> " , " </Code> " )
56
52
)
57
53
let result = strategy. extractSuggestion (
58
54
from: """
@@ -64,8 +60,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
64
60
65
61
func test_whenMarkdownCodeBlockFound_shouldExtractCodeInside( ) {
66
62
let strategy = DefaultRawSuggestionPostProcessingStrategy (
67
- openingCodeTag: " <Code> " ,
68
- closingCodeTag: " </Code> "
63
+ codeWrappingTags: ( " <Code> " , " </Code> " )
69
64
)
70
65
let result = strategy. extractSuggestion (
71
66
from: """
@@ -80,8 +75,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
80
75
81
76
func test_whenOnlyLinebreaksOrSpacesBeforeMarkdownCodeBlock_shouldExtractCodeInside( ) {
82
77
let strategy = DefaultRawSuggestionPostProcessingStrategy (
83
- openingCodeTag: " <Code> " ,
84
- closingCodeTag: " </Code> "
78
+ codeWrappingTags: ( " <Code> " , " </Code> " )
85
79
)
86
80
let result = strategy. extractSuggestion (
87
81
from: """
@@ -120,8 +114,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
120
114
121
115
func test_whenMarkdownCodeBlockAndCodeTagFound_firstlyExtractCodeTag_thenCodeTag( ) {
122
116
let strategy = DefaultRawSuggestionPostProcessingStrategy (
123
- openingCodeTag: " <Code> " ,
124
- closingCodeTag: " </Code> "
117
+ codeWrappingTags: ( " <Code> " , " </Code> " )
125
118
)
126
119
let result = strategy. extractSuggestion (
127
120
from: """
@@ -137,8 +130,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
137
130
func test_whenMarkdownCodeBlockAndCodeTagFound_butNoClosingTag_firstlyExtractCodeTag_thenCodeTag(
138
131
) {
139
132
let strategy = DefaultRawSuggestionPostProcessingStrategy (
140
- openingCodeTag: " <Code> " ,
141
- closingCodeTag: " </Code> "
133
+ codeWrappingTags: ( " <Code> " , " </Code> " )
142
134
)
143
135
let result = strategy. extractSuggestion (
144
136
from: """
@@ -153,8 +145,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
153
145
154
146
func test_whenSuggestionHasTheSamePrefix_removeThePrefix( ) {
155
147
let strategy = DefaultRawSuggestionPostProcessingStrategy (
156
- openingCodeTag: " <Code> " ,
157
- closingCodeTag: " </Code> "
148
+ codeWrappingTags: ( " <Code> " , " </Code> " )
158
149
)
159
150
let result = strategy. extractSuggestion (
160
151
from: " suggestion "
@@ -165,8 +156,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
165
156
166
157
func test_whenSuggestionLooksLikeAMessage_parseItCorrectly( ) {
167
158
let strategy = DefaultRawSuggestionPostProcessingStrategy (
168
- openingCodeTag: " <Code> " ,
169
- closingCodeTag: " </Code> "
159
+ codeWrappingTags: ( " <Code> " , " </Code> " )
170
160
)
171
161
let result = strategy. extractSuggestion (
172
162
from: """
@@ -182,8 +172,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
182
172
183
173
func test_whenSuggestionHasTheSamePrefix_inTags_removeThePrefix( ) {
184
174
let strategy = DefaultRawSuggestionPostProcessingStrategy (
185
- openingCodeTag: " <Code> " ,
186
- closingCodeTag: " </Code> "
175
+ codeWrappingTags: ( " <Code> " , " </Code> " )
187
176
)
188
177
var suggestion = " prefix suggestion "
189
178
strategy. removePrefix ( from: & suggestion, infillPrefix: " prefix " )
@@ -193,8 +182,7 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
193
182
194
183
func test_whenSuggestionHasTheSameSuffix_removeTheSuffix( ) {
195
184
let strategy = DefaultRawSuggestionPostProcessingStrategy (
196
- openingCodeTag: " <Code> " ,
197
- closingCodeTag: " </Code> "
185
+ codeWrappingTags: ( " <Code> " , " </Code> " )
198
186
)
199
187
var suggestion = " suggestion \n a \n b "
200
188
strategy. removeSuffix ( from: & suggestion, suffix: [
@@ -214,11 +202,10 @@ class DefaultRawSuggestionPostProcessingStrategyTests: XCTestCase {
214
202
215
203
XCTAssertEqual ( suggestion3, " suggestion \n a \n " )
216
204
}
217
-
205
+
218
206
func test_case_1( ) {
219
207
let strategy = DefaultRawSuggestionPostProcessingStrategy (
220
- openingCodeTag: " <Code> " ,
221
- closingCodeTag: " </Code> "
208
+ codeWrappingTags: ( " <Code> " , " </Code> " )
222
209
)
223
210
let result = strategy. postProcess (
224
211
rawSuggestion: """
0 commit comments