Skip to content

Commit

Permalink
add replace tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Bossart committed Sep 29, 2016
1 parent e4743aa commit 87b2ff9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Modules/POSIX/Tests/POSIXTests/RegexTests.swift
Expand Up @@ -85,6 +85,18 @@ public class RegexTests: XCTestCase {
let string = regex.replace(in: "hello world", with: "bye")
XCTAssert(string == "hello world")
}

func testReplaceUTF8() throws {
let r0 = try Regex(pattern: "coffee")
let actual0 = r0.replace(in: "Paulo loves coffee", with: "☕️")
XCTAssertEqual(actual0, "Paulo loves ☕️")
}

func testMultipleReplacesUTF8() throws {
let r1 = try Regex(pattern: "[[:digit:]]{4}")
let actual1 = r1.replace(in: "1234-2345-3456-4567", with: "💳")
XCTAssertEqual(actual1, "💳-💳-💳-💳")
}


/// MARK: - matching test
Expand Down

0 comments on commit 87b2ff9

Please sign in to comment.