Documentation
¶
Index ¶
Constants ¶
View Source
const ( TitleDelimiter = "### TITLE ###" DocumentDelimiter = "### DOCUMENT ###" ChangeDelimiter = "### CHANGE ###" CompletionDelimiter = "### COMPLETION" // e.g. "### COMPLETION 0:0 ###" CodeActionDelimiter = "### CODE_ACTION" // e.g. "### CODE_ACTION 0:0 0:0 ###" StdoutDelimiter = "### STDOUT ###" )
Variables ¶
View Source
var UpdateSnapshots = flag.Bool("update", false, "update snapshot expected outputs")
Functions ¶
func Run ¶
func Run(tc *SnapshotCase) (string, error)
Run executes a single snapshot test case against a real in-process server. It handles the full LSP lifecycle: initialization, didOpen, actions, and shutdown. Returns the normalized JSON output of all server messages after the init handshake.
func WriteSnapshotFile ¶
func WriteSnapshotFile(path string, cases []SnapshotCase) error
WriteSnapshotFile writes test cases back to a .snap file.
Types ¶
type ActionType ¶
type ActionType int
const ( ActionChange ActionType = iota ActionCompletion ActionCodeAction )
type SnapshotCase ¶
func ParseSnapshotFile ¶
func ParseSnapshotFile(path string) ([]SnapshotCase, error)
ParseSnapshotFile reads a .snap file and extracts LSP test cases.
Format:
### TITLE ### <test name> ### DOCUMENT ### <rad source code> ### CHANGE ### (optional, repeatable) <new document text> ### COMPLETION 0:0 ### (optional, repeatable, header-only) ### CODE_ACTION 0:0 0:0 ### (optional, repeatable, header-only) ### STDOUT ### <expected server output as normalized JSON>
Click to show internal directories.
Click to hide internal directories.