Skip to content

Commit 2e61abd

Browse files
committed
Add failing test that replicates the issue.
This is a bug on `AutoPProcessor` that emerged after the migration to Swift 5. Ref: wordpress-mobile/WordPress-iOS#11515
1 parent cbd1bb5 commit 2e61abd

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

WordPressEditor/WordPressEditorTests/WordPressPlugin/Calypso/AutopRemovep/AutoPProcessorTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,18 @@ class AutoPProcessorTests: XCTestCase {
101101
let output = processor.process(input)
102102
XCTAssertEqual(output, expected)
103103
}
104+
105+
106+
/// After the migration to Swift 5, there were problems with ranges.
107+
/// This test ensures there are no regresions related to this issue:
108+
/// https://github.com/wordpress-mobile/WordPress-iOS/issues/11515
109+
/// Where the `—` character was messing up the range used to replace the `</blockquote>` string.
110+
/// This is independent of the kind of tag. It needs two different tags with a `new line` character in between to happen.
111+
func testHTMLWithUTF16Characters() {
112+
let html = "<blockquote>A Quote. —— Someone</blockquote>\n<img src=\"#\" />"
113+
let expected = "<blockquote><p>A Quote. —— Someone</p></blockquote>\n<p><img src=\"#\" /></p>\n"
114+
let finalHTML = processor.process(html)
115+
116+
XCTAssertEqual(finalHTML, expected)
117+
}
104118
}

0 commit comments

Comments
 (0)