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
46 lines (35 loc) · 1.26 KB
/
ParseScopesTests.swift
File metadata and controls
46 lines (35 loc) · 1.26 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
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_single_scope_with_prefix() async throws {
var prompt = "@w 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+c+s+project hello"
let scopes = parse(&prompt)
XCTAssertEqual(scopes, [.web, .code, .sense, .project, .file])
XCTAssertEqual(prompt, "hello")
}
}