-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCodeEditTextViewTests.swift
43 lines (34 loc) · 1.19 KB
/
CodeEditTextViewTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import XCTest
@testable import CodeEditTextView
// swiftlint:disable all
final class CodeEditTextViewTests: XCTestCase {
// MARK: NSFont Line Height
func test_LineHeight() throws {
let font = NSFont.monospacedSystemFont(ofSize: 12, weight: .regular)
let result = font.lineHeight
let expected = 15.0
XCTAssertEqual(result, expected)
}
func test_LineHeight2() throws {
let font = NSFont.monospacedSystemFont(ofSize: 0, weight: .regular)
let result = font.lineHeight
let expected = 16.0
XCTAssertEqual(result, expected)
}
// MARK: String NSRange
func test_StringSubscriptNSRange() throws {
let testString = "Hello, World"
let testRange = NSRange(location: 7, length: 5)
let result = String(testString[testRange]!)
let expected = "World"
XCTAssertEqual(result, expected)
}
func test_StringSubscriptNSRange2() throws {
let testString = "Hello,\nWorld"
let testRange = NSRange(location: 7, length: 5)
let result = String(testString[testRange]!)
let expected = "World"
XCTAssertEqual(result, expected)
}
}
// swiftlint:enable all