forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseScopesTests.swift
More file actions
39 lines (29 loc) · 1.04 KB
/
ParseScopesTests.swift
File metadata and controls
39 lines (29 loc) · 1.04 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
import XCTest
@testable import ChatService
final class ParseScopesTests: XCTestCase {
let parse = DynamicContextController.parseScopes
func test_parse_single_scope() async throws {
var prompt = "@web hello"
let scopes = parse(&prompt)
XCTAssertEqual(scopes, ["web"])
XCTAssertEqual(prompt, "hello")
}
func test_parse_multiple_spaces() async throws {
var prompt = "@web hello"
let scopes = parse(&prompt)
XCTAssertEqual(scopes, ["web"])
XCTAssertEqual(prompt, "hello")
}
func test_parse_no_prefix_at_mark() async throws {
var prompt = " @web hello"
let scopes = parse(&prompt)
XCTAssertEqual(scopes, [])
XCTAssertEqual(prompt, prompt)
}
func test_parse_multiple_scopes() async throws {
var prompt = "@web+file+selection hello"
let scopes = parse(&prompt)
XCTAssertEqual(scopes, ["web", "file", "selection"])
XCTAssertEqual(prompt, "hello")
}
}