Skip to content

Commit 362fc8d

Browse files
committed
Add StrikethroughDoubleTildeTests
1 parent 2f2acd0 commit 362fc8d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// StrikethroughDoubleTildeTests.swift
3+
//
4+
//
5+
// Created by Hanny Hariyadi Prastya on 2024/07/18.
6+
//
7+
8+
@testable import Markdown
9+
import XCTest
10+
11+
class StrikethroughDoubleTildeTests: XCTestCase {
12+
/// Verify that only double tildes are parsed as strikethroughs
13+
func testDoubleTildeStrikethrough() {
14+
let text = """
15+
This is a ~~strikethrough~~ example, but this is ~not~.
16+
"""
17+
18+
let expectedDump = """
19+
Document @1:1-1:56
20+
└─ Paragraph @1:1-1:56
21+
├─ Text @1:1-1:11 "This is a "
22+
├─ Strikethrough @1:11-1:28
23+
│ └─ Text @1:13-1:26 "strikethrough"
24+
└─ Text @1:28-1:56 " example, but this is ~not~."
25+
"""
26+
27+
let document = Document(parsing: text, source: nil, options: [.onlyParseStrikethroughDoubleTilde])
28+
XCTAssertEqual(expectedDump, document.debugDescription(options: .printSourceLocations))
29+
}
30+
}

0 commit comments

Comments
 (0)