@@ -13,8 +13,7 @@ class CommentUnwrapperTests: XCTestCase {
1313 // MARK: - Unwrapping
1414
1515 func testUnwrapsLines( ) {
16-
17- //////////////////////////////////////// <-- Guide (40 chars)
16+ //-------------------------------------- <-- Guide (40 chars)
1817 let input = """
1918 ant bear cat dog emu fox gecko heron
2019 iguana jellyfish koala lion monkey newt
@@ -33,7 +32,7 @@ class CommentUnwrapperTests: XCTestCase {
3332 // If this wrapped input had been generated with two spaces between each line,
3433 // unwrapping will lose the double space where the line wraps
3534
36- //////////////////////////////////////// <-- Guide (40 chars)
35+ //-------------------------------------- <-- Guide (40 chars)
3736 let input = """
3837 ant bear cat dog emu fox gecko
3938 heron iguana jellyfish koala lion
@@ -57,8 +56,7 @@ class CommentUnwrapperTests: XCTestCase {
5756 // MARK: - Comment prefix
5857
5958 func testHandlesCommentPrefix( ) {
60-
61- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
59+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
6260 let input = """
6361 // ant bear cat dog emu fox gecko heron
6462 // iguana jellyfish koala lion monkey newt
@@ -76,7 +74,7 @@ class CommentUnwrapperTests: XCTestCase {
7674
7775 func testHandlesNewlines( ) {
7876
79- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
77+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
8078 let input = """
8179 // ant bear cat dog emu fox gecko heron
8280 // iguana jellyfish koala lion monkey newt
@@ -99,7 +97,7 @@ class CommentUnwrapperTests: XCTestCase {
9997
10098 func testHandlesCode( ) {
10199
102- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
100+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
103101 let input = """
104102 // ant bear cat dog emu fox gecko heron
105103 // iguana jellyfish koala lion monkey newt
@@ -127,7 +125,7 @@ class CommentUnwrapperTests: XCTestCase {
127125
128126 func testHandlesMultipleLinesOfCode( ) {
129127
130- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
128+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
131129 let input = """
132130 // ant bear cat dog emu fox gecko heron
133131 // iguana jellyfish koala lion monkey newt
@@ -158,8 +156,7 @@ class CommentUnwrapperTests: XCTestCase {
158156 // MARK: - Bullets
159157
160158 func testHandlesBullets( ) {
161-
162- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
159+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
163160 let input = """
164161 // - First item
165162 // - Second item
@@ -172,7 +169,7 @@ class CommentUnwrapperTests: XCTestCase {
172169
173170 func testHandlesBulletsAfterRegularComments( ) {
174171
175- ////////////////////////////////////////*** <-- Guide ( 40 chars + 3 prefix)
172+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
176173 let input = """
177174 // This is a comment
178175 //
@@ -193,4 +190,29 @@ class CommentUnwrapperTests: XCTestCase {
193190 XCTAssertEqual ( output, expected)
194191 }
195192
193+ func testHandlesMarkdownCodeBlocks( ) {
194+
195+ //* ---------------------------------------- <-- Guide ( 40 chars + 3 prefix)
196+ let input = """
197+ // Below is some code that should not be
198+ // unwrapped.
199+ // ```
200+ // this is the code that should not be unwrapped.
201+ // ```
202+ // Above is some code that should not be
203+ // unwrapped.
204+ """
205+
206+ let expected = """
207+ // Below is some code that should not be unwrapped.
208+ // ```
209+ // this is the code that should not be unwrapped.
210+ // ```
211+ // Above is some code that should not be unwrapped.
212+ """
213+
214+ let output = CommentUnwrapper . unwrap ( string: input)
215+ XCTAssertEqual ( output, expected)
216+ }
217+
196218}
0 commit comments