Skip to content

Commit

Permalink
Merge pull request #7 from vapor-community/gfm-tests
Browse files Browse the repository at this point in the history
Add tests for GFM to ensure it works
  • Loading branch information
0xTim authored Dec 19, 2019
2 parents 475c63a + 7d46291 commit 43d5646
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let package = Package(
.library(name: "SwiftMarkdown", targets: ["SwiftMarkdown"]),
],
dependencies: [
.package(url: "https://github.com/brokenhandsio/cmark-gfm.git", .upToNextMajor(from: "1.0.0")),
.package(url: "https://github.com/brokenhandsio/cmark-gfm.git", from: "2.0.0"),
],
targets: [
.target(name: "SwiftMarkdown", dependencies: ["cmark"]),
Expand Down
6 changes: 0 additions & 6 deletions Tests/LinuxMain.swift

This file was deleted.

33 changes: 29 additions & 4 deletions Tests/SwiftMarkdownTests/SwiftMarkdownTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,36 @@ import SwiftMarkdown

class SwiftMarkdownTests: XCTestCase {

static var allTests = [
("testMDtoHTML", testMDtoHTML),
]

func testMDtoHTML() {
XCTAssertEqual(try markdownToHTML("# Hello"), "<h1>Hello</h1>\n")
}

func testGFMtoHTML() throws {
let input = """
| foo | bar |
| --- | --- |
| baz | bim |
"""
let expectedOutput = """
<table>
<thead>
<tr>
<th>foo</th>
<th>bar</th>
</tr>
</thead>
<tbody>
<tr>
<td>baz</td>
<td>bim</td>
</tr>
</tbody>
</table>
"""

let output = try markdownToHTML(input, options: .safe)

XCTAssertEqual(output, expectedOutput)
}
}

0 comments on commit 43d5646

Please sign in to comment.