1
0
mirror of git://jb55.com/damus synced 2024-10-01 09:20:47 +00:00

content: add utf8 char at url left boundary test

This commit is contained in:
William Casarin 2023-07-16 11:00:19 -07:00
parent 0c95071de7
commit 8d14fdffb5
2 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,27 @@
//
// ContentParserTests.swift
// damusTests
//
// Created by William Casarin on 2023-07-16.
//
import XCTest
final class ContentParserTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

View File

@ -8,7 +8,7 @@
import XCTest
@testable import damus
class DamusParseContentTests: XCTestCase {
class ContentParserTests: XCTestCase {
private let decoder = JSONDecoder()
@ -19,7 +19,18 @@ class DamusParseContentTests: XCTestCase {
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func test_url_parsing_with_emoji() throws {
let url = "https://media.tenor.com/5MibLt95scAAAAAC/%ED%98%BC%ED%8C%8C%EB%A7%9D-%ED%94%BC%EC%9E%90.gif"
let content = "gm 🤙\(url)"
let blocks = parse_note_content(content: content, tags: []).blocks
XCTAssertEqual(blocks.count, 2)
XCTAssertEqual(blocks[0], .text("gm 🤙"))
XCTAssertEqual(blocks[1], .url(URL(string: url)!))
}
func test_damus_parse_content_can_parse_mention_without_white_space_at_front() throws {
var bs = note_blocks()
bs.num_blocks = 0;