Tests/OrgPresentationTests/CommentLineTests.swift

06941b2cf25c6ccc1629723cd7951910ce15e67a
orgstar/Tests/OrgPresentationTests/CommentLineTests.swift history · blame · raw

13 lines · 511 bytes

 1import Foundation
 2import Testing
 3@testable import OrgPresentation
 4
 5struct CommentLineTests {
 6    @Test func matchesThePattern() {
 7        let lines = ["#", "# x", "#+TITLE: a", "  #\n", "\t# \n", "#x", "a # b", "", "#\r\n", "#\r", "#\u{2028}", " #+\n", "##", "  x#"]
 8        for line in lines {
 9            let expected = line.range(of: "^[ \\t]*#([ +]|$)", options: .regularExpression) != nil
10            #expect(Presentation.isCommentOrKeyword(line) == expected, "\(line.debugDescription)")
11        }
12    }
13}