| 1 | package boot |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "reasonix/internal/config" |
| 7 | ) |
| 8 | |
| 9 | func TestLSPSpecsExplicitCommandDoesNotInheritDefaultFallbacks(t *testing.T) { |
| 10 | spec := LSPSpecs(config.LSPConfig{Servers: map[string]config.LSPServer{ |
| 11 | "kotlin": { |
| 12 | Command: "company-kotlin-server", |
| 13 | Args: []string{"--company-mode"}, |
| 14 | }, |
| 15 | }})["kotlin"] |
| 16 | |
| 17 | if spec.Command != "company-kotlin-server" { |
| 18 | t.Fatalf("Command = %q, want explicit user command", spec.Command) |
| 19 | } |
| 20 | if len(spec.Args) != 1 || spec.Args[0] != "--company-mode" { |
| 21 | t.Fatalf("Args = %v, want explicit user arguments", spec.Args) |
| 22 | } |
| 23 | if len(spec.Fallbacks) != 0 { |
| 24 | t.Fatalf("Fallbacks = %v, want none for an explicit user command", spec.Fallbacks) |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func TestLSPSpecsNonCommandOverrideKeepsDefaultFallbacks(t *testing.T) { |
| 29 | spec := LSPSpecs(config.LSPConfig{Servers: map[string]config.LSPServer{ |
| 30 | "kotlin": {InstallHint: "custom install hint"}, |
| 31 | }})["kotlin"] |
| 32 | |
| 33 | if len(spec.Fallbacks) != 1 || spec.Fallbacks[0] != "intellij-server" { |
| 34 | t.Fatalf("Fallbacks = %v, want the built-in intellij-server fallback", spec.Fallbacks) |
| 35 | } |
| 36 | } |
| 37 |