You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func testMarkdownCheckbox_withChecked_withMultibyte() {
let markdown = """
- [x] テスト
- [x] テスト2
"""
let node = Node(markdown: markdown)!
XCTAssertEqual(node.elements.count, 1)
guard case .list(let items, _)? = node.elements.first else { fatalError() }
// get second checkbox after multibyte characters
guard case .paragraph(let paragraph)? = items[1].first else { fatalError() }
guard case .checkbox(let checked, let range) = paragraph[1] else { fatalError() }
XCTAssertEqual(markdown.substring(with: range), "[x]")
}
The location of the checkbox should be converted into multibyte count here.
I'm not sure the best way to get the whole content of the original markdown, but this might work.
var location = Int(cmark_node_get_checkbox_location(node))
if let string = String(bytes: original_markdown.utf8.prefix(location), encoding:.utf8) {
location = string.count
}
The text was updated successfully, but these errors were encountered:
This test will fail.
The location of the checkbox should be converted into multibyte count here.
I'm not sure the best way to get the whole content of the original markdown, but this might work.
The text was updated successfully, but these errors were encountered: