Skip to content

Commit a1d03eb

Browse files
committed
Add tests for empty arguments
1 parent e796045 commit a1d03eb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Tests/Diff/DiffTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ class DiffTests: XCTestCase {
3232
XCTAssertNil(diff("Hello", "Hello"))
3333
}
3434

35+
func testEmptyLHS() {
36+
let (range, string) = diff("", "Hello world")!
37+
XCTAssertEqual(0...0, range)
38+
XCTAssertEqual("Hello world", string)
39+
}
40+
41+
func testEmptyRHS() {
42+
let (range, string) = diff("Hello world", "")!
43+
XCTAssertEqual(0..<11, range)
44+
XCTAssertEqual("", string)
45+
}
46+
3547
func testIntArray() {
3648
let (range, replacement) = diff([1, 2, 3], [1, 2, 3, 4])!
3749
XCTAssertEqual(3...3, range)

0 commit comments

Comments
 (0)