Skip to content

Instantly share code, notes, and snippets.

@eastari
Created May 25, 2020 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eastari/2776b18ecd97d5761a6003c2eb66bcbe to your computer and use it in GitHub Desktop.
Save eastari/2776b18ecd97d5761a6003c2eb66bcbe to your computer and use it in GitHub Desktop.
import XCTest
let searchTerm = "Lorem"
let targetString = "Lorem Ipsum is ... 😀"
let expectedResult = "L̲o̲r̲e̲m̲ Ipsum is ... 😀"
let attributedString = NSMutableAttributedString.generateAttributedString(with: searchTerm, targetString: targetString)
// Convert attributed string to Unicode text.
let mockUnderlineUnicodeText = generateUnderlineUnicodeText(from: attributedString!, by: NSAttributedString.Key.font)
// Test
XCTAssert(mockUnderlineUnicodeText == expectedResult)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment