this repo has no description
www.jonmsterling.com/01HC/
1//
2// File.swift
3// Pterodactyl
4//
5// Created by Jon Sterling on 30/11/2025.
6//
7
8import Foundation
9import Testing
10
11@testable import PterodactylBuild
12@testable import PterodactylLanguageServer
13@testable import TSCBasic
14@testable import llbuild2fx
15
16struct LanguageServerTests {
17 @Test
18 func testSingletonFileTree() throws {
19 let path = try AbsolutePath(validating: "/foo/bar/file.txt")
20 let foo = LLBDeclFileTree.file(absolutePath: path, contents: "foobar")
21 let expected: LLBDeclFileTree =
22 .dir([
23 "foo": .dir([
24 "bar": .dir([
25 "file.txt": .file("foobar")
26 ])
27 ])
28 ])
29
30 #expect(foo.debugDescription == expected.debugDescription)
31 }
32
33 @Test
34 func testSourceTreeManager() async throws {
35 let group = LLBMakeDefaultDispatchGroup()
36 let db = LLBInMemoryCASDatabase(group: group)
37 let functionCache = FXInMemoryFunctionCache(group: group)
38 let executor = FXLocalExecutor()
39 let engine = FXEngine(group: group, db: db, functionCache: functionCache, executor: executor)
40 let client = LLBCASFSClient(db)
41 let context = Context()
42
43 let manager = try await SourceTreeManager(buildEngine: engine, casClient: client, casContext: context)
44 let uri = "file://foo/bar/wooo.txt"
45 let contents = "hello world"
46 try await manager.setBufferText(uri: uri, text: contents)
47 try await #expect(manager.getBufferText(uri: uri) == contents)
48 }
49}