commit 96d8d854e20f15001f490bc233f62c817517941d
parent cfc21219d35b00053a516ab520441f3c8fde966c
Author: William Casarin <jb55@jb55.com>
Date: Wed, 4 May 2022 16:54:10 -0700
test invalid mention
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/damusTests/damusTests.swift b/damusTests/damusTests.swift
@@ -43,6 +43,21 @@ class damusTests: XCTestCase {
XCTAssertTrue(parsed[2].is_text)
}
+ func testParseInvalidMention() throws {
+ let parsed = parse_mentions(content: "this is #[0] a mention", tags: [])
+
+ XCTAssertNotNil(parsed)
+ XCTAssertEqual(parsed.count, 1)
+ XCTAssertTrue(parsed[0].is_text)
+
+ guard case .text(let txt) = parsed[0] else {
+ XCTAssertTrue(false)
+ return
+ }
+
+ XCTAssertEqual(txt, "this is #[0] a mention")
+ }
+
func testParseMentionBlank() {
let parsed = parse_mentions(content: "", tags: [["e", "event_id"]])