(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestDocumentManager(t *testing.T) { |
| 65 | dm := NewDocumentManager() |
| 66 | |
| 67 | // Test Open |
| 68 | dm.Open("file:///test.sql", "sql", 1, "SELECT * FROM users") |
| 69 | |
| 70 | doc, ok := dm.Get("file:///test.sql") |
| 71 | if !ok { |
| 72 | t.Fatal("expected document to be found") |
| 73 | } |
| 74 | if doc.Content != "SELECT * FROM users" { |
| 75 | t.Errorf("expected content 'SELECT * FROM users', got %q", doc.Content) |
| 76 | } |
| 77 | if doc.Version != 1 { |
| 78 | t.Errorf("expected version 1, got %d", doc.Version) |
| 79 | } |
| 80 | |
| 81 | // Test Update with full sync |
| 82 | dm.Update("file:///test.sql", 2, []TextDocumentContentChangeEvent{ |
| 83 | {Text: "SELECT id FROM users"}, |
| 84 | }) |
| 85 | |
| 86 | content, ok := dm.GetContent("file:///test.sql") |
| 87 | if !ok { |
| 88 | t.Fatal("expected content to be found") |
| 89 | } |
| 90 | if content != "SELECT id FROM users" { |
| 91 | t.Errorf("expected updated content, got %q", content) |
| 92 | } |
| 93 | |
| 94 | // Test Close |
| 95 | dm.Close("file:///test.sql") |
| 96 | _, ok = dm.Get("file:///test.sql") |
| 97 | if ok { |
| 98 | t.Fatal("expected document to be closed") |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func TestDocumentGetWordAtPosition(t *testing.T) { |
| 103 | doc := &Document{ |
nothing calls this directly
no test coverage detected