mirror of
git://jb55.com/damus
synced 2024-10-01 17:30:44 +00:00
content: add utf8 char at url left boundary test
This commit is contained in:
parent
0c95071de7
commit
8d14fdffb5
27
damusTests/ContentParserTests.swift
Normal file
27
damusTests/ContentParserTests.swift
Normal 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.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
import XCTest
|
||||
@testable import damus
|
||||
|
||||
class DamusParseContentTests: XCTestCase {
|
||||
class ContentParserTests: XCTestCase {
|
||||
|
||||
private let decoder = JSONDecoder()
|
||||
|
||||
@ -20,6 +20,17 @@ class DamusParseContentTests: XCTestCase {
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user