Skip to content

Commit

Permalink
Merge pull request #1 from JohnSundell/linux-ci
Browse files Browse the repository at this point in the history
Linux: Include all test cases
  • Loading branch information
JohnSundell committed Nov 25, 2019
2 parents ef49ee8 + 1f3c2fb commit 5278fce
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Tests/InkTests/CodeTests.swift
Expand Up @@ -62,3 +62,15 @@ final class CodeTests: XCTestCase {
""")
}
}

extension CodeTests {
static var allTests: [(String, TestClosure<CodeTests>)] {
return [
("testInlineCode", testInlineCode),
("testCodeBlockWithJustBackticks", testCodeBlockWithJustBackticks),
("testCodeBlockWithBackticksAndLabel", testCodeBlockWithBackticksAndLabel),
("testEncodingSpecialCharactersWithinCodeBlock", testEncodingSpecialCharactersWithinCodeBlock),
("testIgnoringFormattingWithinCodeBlock", testIgnoringFormattingWithinCodeBlock)
]
}
}
17 changes: 17 additions & 0 deletions Tests/InkTests/HTMLTests.swift
Expand Up @@ -94,3 +94,20 @@ final class HTMLTests: XCTestCase {
XCTAssertEqual(html, "<p>Hello</p><br/><p>World</p>")
}
}

extension HTMLTests {
static var allTests: [(String, TestClosure<HTMLTests>)] {
return [
("testTopLevelHTML", testTopLevelHTML),
("testNestedTopLevelHTML", testNestedTopLevelHTML),
("testTopLevelHTMLWithPreviousNewline", testTopLevelHTMLWithPreviousNewline),
("testIgnoringFormattingWithinTopLevelHTML", testIgnoringFormattingWithinTopLevelHTML),
("testIgnoringTextFormattingWithinInlineHTML", testIgnoringTextFormattingWithinInlineHTML),
("testIgnoringListsWithinInlineHTML", testIgnoringListsWithinInlineHTML),
("testInlineParagraphTagEndingCurrentParagraph", testInlineParagraphTagEndingCurrentParagraph),
("testTopLevelSelfClosingHTMLElement", testTopLevelSelfClosingHTMLElement),
("testInlineSelfClosingHTMLElement", testInlineSelfClosingHTMLElement),
("testTopLevelHTMLLineBreak", testTopLevelHTMLLineBreak)
]
}
}
13 changes: 13 additions & 0 deletions Tests/InkTests/HeadingTests.swift
Expand Up @@ -47,3 +47,16 @@ final class HeadingTests: XCTestCase {
XCTAssertEqual(html, "<p>\(markdown)</p>")
}
}

extension HeadingTests {
static var allTests: [(String, TestClosure<HeadingTests>)] {
return [
("testHeading", testHeading),
("testHeadingsSeparatedBySingleNewline", testHeadingsSeparatedBySingleNewline),
("testHeadingsWithLeadingNumbers", testHeadingsWithLeadingNumbers),
("testHeadingWithPreviousWhitespace", testHeadingWithPreviousWhitespace),
("testHeadingWithPreviousNewlineAndWhitespace", testHeadingWithPreviousNewlineAndWhitespace),
("testInvalidHeaderLevel", testInvalidHeaderLevel)
]
}
}
10 changes: 10 additions & 0 deletions Tests/InkTests/HorizontalLineTests.swift
Expand Up @@ -37,3 +37,13 @@ final class HorizontalLineTests: XCTestCase {
XCTAssertEqual(html, "<p>Hello</p><hr/><p>World</p>")
}
}

extension HorizontalLineTests {
static var allTests: [(String, TestClosure<HorizontalLineTests>)] {
return [
("testHorizonalLineWithDashes", testHorizonalLineWithDashes),
("testHorizontalLineWithDashesAtTheStartOfString", testHorizontalLineWithDashesAtTheStartOfString),
("testHorizontalLineWithAsterisks", testHorizontalLineWithAsterisks)
]
}
}
12 changes: 12 additions & 0 deletions Tests/InkTests/ImageTests.swift
Expand Up @@ -41,3 +41,15 @@ final class ImageTests: XCTestCase {
XCTAssertEqual(html, #"<p>Text <img src="url"/> text</p>"#)
}
}

extension ImageTests {
static var allTests: [(String, TestClosure<ImageTests>)] {
return [
("testImageWithURL", testImageWithURL),
("testImageWithReference", testImageWithReference),
("testImageWithURLAndAltText", testImageWithURLAndAltText),
("testImageWithReferenceAndAltText", testImageWithReferenceAndAltText),
("testImageWithinParagraph", testImageWithinParagraph)
]
}
}
13 changes: 13 additions & 0 deletions Tests/InkTests/LinkTests.swift
Expand Up @@ -48,3 +48,16 @@ final class LinkTests: XCTestCase {
XCTAssertEqual(html, "<p><a href=\"/he_llo\">He_llo</a></p>")
}
}

extension LinkTests {
static var allTests: [(String, TestClosure<LinkTests>)] {
return [
("testLinkWithURL", testLinkWithURL),
("testLinkWithReference", testLinkWithReference),
("testNumericLinkWithReference", testNumericLinkWithReference),
("testBoldLinkWithInternalMarkers", testBoldLinkWithInternalMarkers),
("testBoldLinkWithExternalMarkers", testBoldLinkWithExternalMarkers),
("testLinkWithUnderscores", testLinkWithUnderscores)
]
}
}
14 changes: 14 additions & 0 deletions Tests/InkTests/ListTests.swift
Expand Up @@ -95,3 +95,17 @@ final class ListTests: XCTestCase {
XCTAssertEqual(html, "<ul><li>One -Two</li><li>Three</li></ul>")
}
}

extension ListTests {
static var allTests: [(String, TestClosure<ListTests>)] {
return [
("testOrderedList", testOrderedList),
("testOrderedListWithoutIncrementedNumbers", testOrderedListWithoutIncrementedNumbers),
("testOrderedListWithInvalidNumbers", testOrderedListWithInvalidNumbers),
("testUnorderedList", testUnorderedList),
("testUnorderedListWithMultiLineItem", testUnorderedListWithMultiLineItem),
("testUnorderedListWithNestedList", testUnorderedListWithNestedList),
("testUnorderedListWithInvalidMarker", testUnorderedListWithInvalidMarker)
]
}
}
11 changes: 11 additions & 0 deletions Tests/InkTests/MetadataTests.swift
Expand Up @@ -67,3 +67,14 @@ final class MetadataTests: XCTestCase {
XCTAssertEqual(markdown.html, "<h1>Title</h1>")
}
}

extension MetadataTests {
static var allTests: [(String, TestClosure<MetadataTests>)] {
return [
("testParsingMetadata", testParsingMetadata),
("testDiscardingEmptyMetadataValues", testDiscardingEmptyMetadataValues),
("testMergingOrphanMetadataValueIntoPreviousOne", testMergingOrphanMetadataValueIntoPreviousOne),
("testMissingMetadata", testMissingMetadata)
]
}
}
11 changes: 11 additions & 0 deletions Tests/InkTests/ModifierTests.swift
Expand Up @@ -77,3 +77,14 @@ final class ModifierTests: XCTestCase {
XCTAssertEqual(html, "<p>Code is cool:</p><pre><code>Code</code></pre>")
}
}

extension ModifierTests {
static var allTests: [(String, TestClosure<ModifierTests>)] {
return [
("testModifierInput", testModifierInput),
("testInitializingParserWithModifiers", testInitializingParserWithModifiers),
("testAddingModifiers", testAddingModifiers),
("testMultipleModifiersForSameTarget", testMultipleModifiersForSameTarget)
]
}
}
9 changes: 9 additions & 0 deletions Tests/InkTests/TestClosure.swift
@@ -0,0 +1,9 @@
/**
* Ink
* Copyright (c) John Sundell 2019
* MIT license, see LICENSE file for details
*/

import XCTest

typealias TestClosure<T: XCTestCase> = (T) -> () throws -> Void
31 changes: 31 additions & 0 deletions Tests/InkTests/TextFormattingTests.swift
Expand Up @@ -137,3 +137,34 @@ final class TextFormattingTests: XCTestCase {
XCTAssertEqual(html, "<p># Not a title *Not italic*</p>")
}
}

extension TextFormattingTests {
static var allTests: [(String, TestClosure<TextFormattingTests>)] {
return [
("testParagraph", testParagraph),
("testItalicText", testItalicText),
("testBoldText", testBoldText),
("testItalicBoldText", testItalicBoldText),
("testItalicBoldTextWithSeparateStartMarkers", testItalicBoldTextWithSeparateStartMarkers),
("testItalicTextWithinBoldText", testItalicTextWithinBoldText),
("testBoldTextWithinItalicText", testBoldTextWithinItalicText),
("testItalicTextWithExtraLeadingMarkers", testItalicTextWithExtraLeadingMarkers),
("testBoldTextWithExtraLeadingMarkers", testBoldTextWithExtraLeadingMarkers),
("testItalicTextWithExtraTrailingMarkers", testItalicTextWithExtraTrailingMarkers),
("testBoldTextWithExtraTrailingMarkers", testBoldTextWithExtraTrailingMarkers),
("testItalicBoldTextWithExtraTrailingMarkers", testItalicBoldTextWithExtraTrailingMarkers),
("testUnterminatedItalicMarker", testUnterminatedItalicMarker),
("testUnterminatedBoldMarker", testUnterminatedBoldMarker),
("testUnterminatedItalicBoldMarker", testUnterminatedItalicBoldMarker),
("testUnterminatedItalicMarkerWithinBoldText", testUnterminatedItalicMarkerWithinBoldText),
("testUnterminatedBoldMarkerWithinItalicText", testUnterminatedBoldMarkerWithinItalicText),
("testStrikethroughText", testStrikethroughText),
("testSingleTildeWithinStrikethroughText", testSingleTildeWithinStrikethroughText),
("testUnterminatedStrikethroughMarker", testUnterminatedStrikethroughMarker),
("testEncodingSpecialCharacters", testEncodingSpecialCharacters),
("testSingleLineBlockquote", testSingleLineBlockquote),
("testMultiLineBlockquote", testMultiLineBlockquote),
("testEscapingSymbolsWithBackslash", testEscapingSymbolsWithBackslash)
]
}
}
6 changes: 5 additions & 1 deletion Tests/InkTests/XCTestManifests.swift
Expand Up @@ -9,11 +9,15 @@ import XCTest
#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(InkTests.allTests),
testCase(CodeTests.allTests),
testCase(HeadingTests.allTests),
testCase(HorizontalLineTests.allTests),
testCase(HTMLTests.allTests),
testCase(ImageTests.allTests),
testCase(LinkTests.allTests),
testCase(ListTests.allTests),
testCase(MetadataTests.allTests),
testCase(ModifierTests.allTests),
testCase(TextFormattingTests.allTests)
]
}
Expand Down

0 comments on commit 5278fce

Please sign in to comment.