diff --git a/Tests/InkTests/CodeTests.swift b/Tests/InkTests/CodeTests.swift index d639550..a3cdfb4 100644 --- a/Tests/InkTests/CodeTests.swift +++ b/Tests/InkTests/CodeTests.swift @@ -62,3 +62,15 @@ final class CodeTests: XCTestCase { """) } } + +extension CodeTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testInlineCode", testInlineCode), + ("testCodeBlockWithJustBackticks", testCodeBlockWithJustBackticks), + ("testCodeBlockWithBackticksAndLabel", testCodeBlockWithBackticksAndLabel), + ("testEncodingSpecialCharactersWithinCodeBlock", testEncodingSpecialCharactersWithinCodeBlock), + ("testIgnoringFormattingWithinCodeBlock", testIgnoringFormattingWithinCodeBlock) + ] + } +} diff --git a/Tests/InkTests/HTMLTests.swift b/Tests/InkTests/HTMLTests.swift index cff9f78..5dab70b 100644 --- a/Tests/InkTests/HTMLTests.swift +++ b/Tests/InkTests/HTMLTests.swift @@ -94,3 +94,20 @@ final class HTMLTests: XCTestCase { XCTAssertEqual(html, "

Hello


World

") } } + +extension HTMLTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testTopLevelHTML", testTopLevelHTML), + ("testNestedTopLevelHTML", testNestedTopLevelHTML), + ("testTopLevelHTMLWithPreviousNewline", testTopLevelHTMLWithPreviousNewline), + ("testIgnoringFormattingWithinTopLevelHTML", testIgnoringFormattingWithinTopLevelHTML), + ("testIgnoringTextFormattingWithinInlineHTML", testIgnoringTextFormattingWithinInlineHTML), + ("testIgnoringListsWithinInlineHTML", testIgnoringListsWithinInlineHTML), + ("testInlineParagraphTagEndingCurrentParagraph", testInlineParagraphTagEndingCurrentParagraph), + ("testTopLevelSelfClosingHTMLElement", testTopLevelSelfClosingHTMLElement), + ("testInlineSelfClosingHTMLElement", testInlineSelfClosingHTMLElement), + ("testTopLevelHTMLLineBreak", testTopLevelHTMLLineBreak) + ] + } +} diff --git a/Tests/InkTests/HeadingTests.swift b/Tests/InkTests/HeadingTests.swift index 33c39cd..ea3aa21 100644 --- a/Tests/InkTests/HeadingTests.swift +++ b/Tests/InkTests/HeadingTests.swift @@ -47,3 +47,16 @@ final class HeadingTests: XCTestCase { XCTAssertEqual(html, "

\(markdown)

") } } + +extension HeadingTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testHeading", testHeading), + ("testHeadingsSeparatedBySingleNewline", testHeadingsSeparatedBySingleNewline), + ("testHeadingsWithLeadingNumbers", testHeadingsWithLeadingNumbers), + ("testHeadingWithPreviousWhitespace", testHeadingWithPreviousWhitespace), + ("testHeadingWithPreviousNewlineAndWhitespace", testHeadingWithPreviousNewlineAndWhitespace), + ("testInvalidHeaderLevel", testInvalidHeaderLevel) + ] + } +} diff --git a/Tests/InkTests/HorizontalLineTests.swift b/Tests/InkTests/HorizontalLineTests.swift index a8adebe..0ecab96 100644 --- a/Tests/InkTests/HorizontalLineTests.swift +++ b/Tests/InkTests/HorizontalLineTests.swift @@ -37,3 +37,13 @@ final class HorizontalLineTests: XCTestCase { XCTAssertEqual(html, "

Hello


World

") } } + +extension HorizontalLineTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testHorizonalLineWithDashes", testHorizonalLineWithDashes), + ("testHorizontalLineWithDashesAtTheStartOfString", testHorizontalLineWithDashesAtTheStartOfString), + ("testHorizontalLineWithAsterisks", testHorizontalLineWithAsterisks) + ] + } +} diff --git a/Tests/InkTests/ImageTests.swift b/Tests/InkTests/ImageTests.swift index fafc112..1a8e354 100644 --- a/Tests/InkTests/ImageTests.swift +++ b/Tests/InkTests/ImageTests.swift @@ -41,3 +41,15 @@ final class ImageTests: XCTestCase { XCTAssertEqual(html, #"

Text text

"#) } } + +extension ImageTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testImageWithURL", testImageWithURL), + ("testImageWithReference", testImageWithReference), + ("testImageWithURLAndAltText", testImageWithURLAndAltText), + ("testImageWithReferenceAndAltText", testImageWithReferenceAndAltText), + ("testImageWithinParagraph", testImageWithinParagraph) + ] + } +} diff --git a/Tests/InkTests/LinkTests.swift b/Tests/InkTests/LinkTests.swift index 3524923..c2987e0 100644 --- a/Tests/InkTests/LinkTests.swift +++ b/Tests/InkTests/LinkTests.swift @@ -48,3 +48,16 @@ final class LinkTests: XCTestCase { XCTAssertEqual(html, "

He_llo

") } } + +extension LinkTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testLinkWithURL", testLinkWithURL), + ("testLinkWithReference", testLinkWithReference), + ("testNumericLinkWithReference", testNumericLinkWithReference), + ("testBoldLinkWithInternalMarkers", testBoldLinkWithInternalMarkers), + ("testBoldLinkWithExternalMarkers", testBoldLinkWithExternalMarkers), + ("testLinkWithUnderscores", testLinkWithUnderscores) + ] + } +} diff --git a/Tests/InkTests/ListTests.swift b/Tests/InkTests/ListTests.swift index 74d4bf1..480e0cc 100644 --- a/Tests/InkTests/ListTests.swift +++ b/Tests/InkTests/ListTests.swift @@ -95,3 +95,17 @@ final class ListTests: XCTestCase { XCTAssertEqual(html, "
  • One -Two
  • Three
") } } + +extension ListTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testOrderedList", testOrderedList), + ("testOrderedListWithoutIncrementedNumbers", testOrderedListWithoutIncrementedNumbers), + ("testOrderedListWithInvalidNumbers", testOrderedListWithInvalidNumbers), + ("testUnorderedList", testUnorderedList), + ("testUnorderedListWithMultiLineItem", testUnorderedListWithMultiLineItem), + ("testUnorderedListWithNestedList", testUnorderedListWithNestedList), + ("testUnorderedListWithInvalidMarker", testUnorderedListWithInvalidMarker) + ] + } +} diff --git a/Tests/InkTests/MetadataTests.swift b/Tests/InkTests/MetadataTests.swift index 452d204..e1def6d 100644 --- a/Tests/InkTests/MetadataTests.swift +++ b/Tests/InkTests/MetadataTests.swift @@ -67,3 +67,14 @@ final class MetadataTests: XCTestCase { XCTAssertEqual(markdown.html, "

Title

") } } + +extension MetadataTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testParsingMetadata", testParsingMetadata), + ("testDiscardingEmptyMetadataValues", testDiscardingEmptyMetadataValues), + ("testMergingOrphanMetadataValueIntoPreviousOne", testMergingOrphanMetadataValueIntoPreviousOne), + ("testMissingMetadata", testMissingMetadata) + ] + } +} diff --git a/Tests/InkTests/ModifierTests.swift b/Tests/InkTests/ModifierTests.swift index b3a8048..cc564c0 100644 --- a/Tests/InkTests/ModifierTests.swift +++ b/Tests/InkTests/ModifierTests.swift @@ -77,3 +77,14 @@ final class ModifierTests: XCTestCase { XCTAssertEqual(html, "

Code is cool:

Code
") } } + +extension ModifierTests { + static var allTests: [(String, TestClosure)] { + return [ + ("testModifierInput", testModifierInput), + ("testInitializingParserWithModifiers", testInitializingParserWithModifiers), + ("testAddingModifiers", testAddingModifiers), + ("testMultipleModifiersForSameTarget", testMultipleModifiersForSameTarget) + ] + } +} diff --git a/Tests/InkTests/TestClosure.swift b/Tests/InkTests/TestClosure.swift new file mode 100644 index 0000000..34abaa9 --- /dev/null +++ b/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) -> () throws -> Void diff --git a/Tests/InkTests/TextFormattingTests.swift b/Tests/InkTests/TextFormattingTests.swift index dc9735e..f9544f7 100644 --- a/Tests/InkTests/TextFormattingTests.swift +++ b/Tests/InkTests/TextFormattingTests.swift @@ -137,3 +137,34 @@ final class TextFormattingTests: XCTestCase { XCTAssertEqual(html, "

# Not a title *Not italic*

") } } + +extension TextFormattingTests { + static var allTests: [(String, TestClosure)] { + 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) + ] + } +} diff --git a/Tests/InkTests/XCTestManifests.swift b/Tests/InkTests/XCTestManifests.swift index 38c193a..e3ce90b 100644 --- a/Tests/InkTests/XCTestManifests.swift +++ b/Tests/InkTests/XCTestManifests.swift @@ -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) ] }