forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPseudoCommandHandlerFileProcessingTests.swift
More file actions
43 lines (38 loc) · 1.52 KB
/
PseudoCommandHandlerFileProcessingTests.swift
File metadata and controls
43 lines (38 loc) · 1.52 KB
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 SuggestionModel
import XCTest
@testable import Service
class PseudoCommandHandlerFileProcessingTests: XCTestCase {
func test_convert_range_0_0() {
XCTAssertEqual(
PseudoCommandHandler().convertRangeToCursorRange(0...0, in: "\n"),
CursorRange(start: .zero, end: .init(line: 0, character: 0))
)
}
func test_convert_range_same_line() {
XCTAssertEqual(
PseudoCommandHandler().convertRangeToCursorRange(1...5, in: "123456789\n"),
CursorRange(start: .init(line: 0, character: 1), end: .init(line: 0, character: 5))
)
}
func test_convert_range_multiple_line() {
XCTAssertEqual(
PseudoCommandHandler()
.convertRangeToCursorRange(5...25, in: "123456789\n123456789\n123456789\n"),
CursorRange(start: .init(line: 0, character: 5), end: .init(line: 2, character: 5))
)
}
func test_convert_range_all_line() {
XCTAssertEqual(
PseudoCommandHandler()
.convertRangeToCursorRange(0...29, in: "123456789\n123456789\n123456789\n"),
CursorRange(start: .init(line: 0, character: 0), end: .init(line: 2, character: 9))
)
}
func test_convert_range_out_of_range() {
XCTAssertEqual(
PseudoCommandHandler()
.convertRangeToCursorRange(0...70, in: "123456789\n123456789\n123456789\n"),
CursorRange(start: .init(line: 0, character: 0), end: .init(line: 3, character: 0))
)
}
}