7 "github.com/charmbracelet/crush/internal/config"
8 "github.com/charmbracelet/crush/internal/env"
11func TestClient(t *testing.T) {
12 ctx := context.Background()
14 // Create a simple config for testing
15 cfg := config.LSPConfig{
16 Command: "$THE_CMD", // Use echo as a dummy command that won't fail
17 Args: []string{"hello"},
18 FileTypes: []string{"go"},
19 Env: map[string]string{},
22 // Test creating a powernap client - this will likely fail with echo
23 // but we can still test the basic structure
24 client, err := New(ctx, "test", cfg, config.NewEnvironmentVariableResolver(env.NewFromMap(map[string]string{
28 // Expected to fail with echo command, skip the rest
29 t.Skipf("Powernap client creation failed as expected with dummy command: %v", err)
33 // If we get here, test basic interface methods
34 if client.GetName() != "test" {
35 t.Errorf("Expected name 'test', got '%s'", client.GetName())
38 if !client.HandlesFile("test.go") {
39 t.Error("Expected client to handle .go files")
42 if client.HandlesFile("test.py") {
43 t.Error("Expected client to not handle .py files")
47 client.SetServerState(StateReady)
48 if client.GetServerState() != StateReady {
49 t.Error("Expected server state to be StateReady")
52 // Clean up - expect this to fail with echo command
53 if err := client.Close(t.Context()); err != nil {
54 // Expected to fail with echo command
55 t.Logf("Close failed as expected with dummy command: %v", err)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list