Skip to content

Commit 9504cbb

Browse files
committed
Fix everythindDocument
1 parent 15d3168 commit 9504cbb

File tree

3 files changed

+31
-71
lines changed

3 files changed

+31
-71
lines changed

[email protected]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let package = Package(
4141
.testTarget(
4242
name: "MarkdownTests",
4343
dependencies: ["Markdown"],
44-
exclude: ["Visitors/Everything.md"]),
44+
resources: [.process("Visitors/Everything.md")]),
4545
.target(name: "CAtomic"),
4646
]
4747
)

Tests/MarkdownTests/Visitors/MarkupRewriterTests.swift

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,7 @@ import XCTest
1212
@testable import Markdown
1313

1414
/// A `Document` that has every kind of element in it at least once.
15-
let everythingDocument = Document(parsing: """
16-
# Header
17-
18-
*Emphasized* **strong** `inline code` [link](foo) ![image](foo).
19-
20-
- this
21-
- is
22-
- a
23-
- list
24-
25-
1. eggs
26-
1. milk
27-
28-
> BlockQuote
29-
30-
```swift
31-
func foo() {
32-
let x = 1
33-
}
34-
```
35-
36-
// Is this real code? Or just fantasy?
37-
38-
This is an <topic://autolink>.
39-
40-
---
41-
42-
<a href="foo.png">
43-
An HTML Block.
44-
</a>
45-
46-
This is some <p>inline html</p>.
47-
48-
line
49-
break
50-
51-
soft
52-
break
53-
""")
15+
let everythingDocument = Document(parsing: try! String(contentsOf: Bundle.module.url(forResource: "Everything", withExtension: "md")!))
5416

5517

5618
class MarkupRewriterTests: XCTestCase {

Tests/MarkdownTests/Visitors/MarkupTreeDumperTests.swift

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import XCTest
1414
final class MarkupTreeDumperTests: XCTestCase {
1515
func testDumpEverything() {
1616
let expectedDump = """
17-
Document @1:1-37:6 Root #\(everythingDocument.raw.metadata.id.rootId) #0
17+
Document @1:1-35:90 Root #\(everythingDocument.raw.metadata.id.rootId) #0
1818
├─ Heading @1:1-1:9 #1 level: 1
1919
│ └─ Text @1:3-1:9 #2 "Header"
2020
├─ Paragraph @3:1-3:65 #3
@@ -52,39 +52,37 @@ final class MarkupTreeDumperTests: XCTestCase {
5252
│ └─ ListItem @11:1-12:1 #35
5353
│ └─ Paragraph @11:4-11:8 #36
5454
│ └─ Text @11:4-11:8 #37 "milk"
55-
├─ BlockQuote @13:1-13:14 #38
56-
│ └─ Paragraph @13:3-13:14 #39
55+
├─ BlockQuote @13:1-13:13 #38
56+
│ └─ Paragraph @13:3-13:13 #39
5757
│ └─ Text @13:3-13:13 #40 "BlockQuote"
58-
├─ CodeBlock @15:1-19:4 #41 language: swift
59-
│ func foo() {
60-
│ let x = 1
61-
│ }
62-
├─ CodeBlock @21:5-22:1 #42 language: none
63-
│ // Is this real code? Or just fantasy?
64-
├─ Paragraph @23:1-23:31 #43
65-
│ ├─ Text @23:1-23:12 #44 "This is an "
66-
│ ├─ Link @23:12-23:30 #45 destination: "topic://autolink"
67-
│ │ └─ Text @23:13-23:29 #46 "topic://autolink"
68-
│ └─ Text @23:30-23:31 #47 "."
69-
├─ ThematicBreak @25:1-26:1 #48
70-
├─ HTMLBlock @27:1-29:5 #49
58+
├─ CodeBlock @15:1-17:4 #41 language: swift
59+
│ func foo() { let x = 1 }
60+
├─ Paragraph @19:1-19:31 #42
61+
│ ├─ Text @19:1-19:12 #43 "This is an "
62+
│ ├─ Link @19:12-19:30 #44 destination: "topic://autolink"
63+
│ │ └─ Text @19:13-19:29 #45 "topic://autolink"
64+
│ └─ Text @19:30-19:31 #46 "."
65+
├─ ThematicBreak @21:1-22:1 #47
66+
├─ HTMLBlock @23:1-25:5 #48
7167
│ <a href="foo.png">
72-
│ An HTML Block.
68+
An HTML Block.
7369
│ </a>
74-
├─ Paragraph @31:1-31:33 #50
75-
│ ├─ Text @31:1-31:14 #51 "This is some "
76-
│ ├─ InlineHTML @31:14-31:17 #52 <p>
77-
│ ├─ Text @31:17-31:28 #53 "inline html"
78-
│ ├─ InlineHTML @31:28-31:32 #54 </p>
79-
│ └─ Text @31:32-31:33 #55 "."
80-
├─ Paragraph @33:1-34:6 #56
81-
│ ├─ Text @33:1-33:7 #57 "line"
82-
│ ├─ LineBreak #58
83-
│ └─ Text @34:1-34:6 #59 "break"
84-
└─ Paragraph @36:1-37:6 #60
85-
├─ Text @36:1-36:5 #61 "soft"
86-
├─ SoftBreak #62
87-
└─ Text @37:1-37:6 #63 "break"
70+
├─ Paragraph @27:1-27:33 #49
71+
│ ├─ Text @27:1-27:14 #50 "This is some "
72+
│ ├─ InlineHTML @27:14-27:17 #51 <p>
73+
│ ├─ Text @27:17-27:28 #52 "inline html"
74+
│ ├─ InlineHTML @27:28-27:32 #53 </p>
75+
│ └─ Text @27:32-27:33 #54 "."
76+
├─ Paragraph @29:1-30:6 #55
77+
│ ├─ Text @29:1-29:7 #56 "line"
78+
│ ├─ LineBreak #57
79+
│ └─ Text @30:1-30:6 #58 "break"
80+
├─ Paragraph @32:1-33:6 #59
81+
│ ├─ Text @32:1-32:5 #60 "soft"
82+
│ ├─ SoftBreak #61
83+
│ └─ Text @33:1-33:6 #62 "break"
84+
└─ HTMLBlock @35:1-35:90 #63
85+
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
8886
"""
8987
print(everythingDocument.debugDescription(options: [.printEverything]))
9088
XCTAssertEqual(expectedDump, everythingDocument.debugDescription(options: [.printEverything]))

0 commit comments

Comments
 (0)