Skip to content

Commit c03ce88

Browse files
committed
Fix tests
1 parent 403a918 commit c03ce88

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Core/Tests/ChatServiceTests/ParseScopesTests.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@ final class ParseScopesTests: XCTestCase {
88
func test_parse_single_scope() async throws {
99
var prompt = "@web hello"
1010
let scopes = parse(&prompt)
11-
XCTAssertEqual(scopes, ["web"])
11+
XCTAssertEqual(scopes, [.web])
12+
XCTAssertEqual(prompt, "hello")
13+
}
14+
15+
func test_parse_single_scope_with_prefix() async throws {
16+
var prompt = "@w hello"
17+
let scopes = parse(&prompt)
18+
XCTAssertEqual(scopes, [.web])
1219
XCTAssertEqual(prompt, "hello")
1320
}
1421

1522
func test_parse_multiple_spaces() async throws {
1623
var prompt = "@web hello"
1724
let scopes = parse(&prompt)
18-
XCTAssertEqual(scopes, ["web"])
25+
XCTAssertEqual(scopes, [.web])
1926
XCTAssertEqual(prompt, "hello")
2027
}
2128

@@ -27,9 +34,9 @@ final class ParseScopesTests: XCTestCase {
2734
}
2835

2936
func test_parse_multiple_scopes() async throws {
30-
var prompt = "@web+file+selection hello"
37+
var prompt = "@web+file+c+s+project hello"
3138
let scopes = parse(&prompt)
32-
XCTAssertEqual(scopes, ["web", "file", "selection"])
39+
XCTAssertEqual(scopes, [.web, .code, .sense, .project, .file])
3340
XCTAssertEqual(prompt, "hello")
3441
}
3542
}

Tool/Tests/ActiveDocumentChatContextCollectorTests/SwiftFocusedCodeFinderTests.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ final class SwiftFocusedCodeFinder_FocusedCode_Tests: XCTestCase {
355355
XCTAssertEqual(context, .init(
356356
scope: .top,
357357
contextRange: .init(startPair: (0, 0), endPair: (13, 2)),
358-
focusedRange: .init(startPair: (0, 0), endPair: (10, 15)),
358+
focusedRange: .init(startPair: (0, 0), endPair: (13, 2)),
359359
focusedCode: """
360360
@MainActor
361361
public
@@ -368,6 +368,9 @@ final class SwiftFocusedCodeFinder_FocusedCode_Tests: XCTestCase {
368368
}
369369
370370
func hello() {
371+
print("hello")
372+
print("hello")
373+
}
371374
372375
""",
373376
imports: []

0 commit comments

Comments
 (0)