|
| 1 | +import { dartQuery } from "../queries" |
| 2 | +import { testParseSourceCodeDefinitions } from "./helpers" |
| 3 | +import sampleDartContent from "./fixtures/sample-dart" |
| 4 | + |
| 5 | +const dartOptions = { |
| 6 | + language: "dart", |
| 7 | + wasmFile: "tree-sitter-dart.wasm", |
| 8 | + queryString: dartQuery, |
| 9 | + extKey: "dart", |
| 10 | +} |
| 11 | + |
| 12 | +describe("parseSourceCodeDefinitionsForFile with Dart", () => { |
| 13 | + it("should capture common Dart declarations", async () => { |
| 14 | + const result = await testParseSourceCodeDefinitions("/test/file.dart", sampleDartContent, dartOptions) |
| 15 | + |
| 16 | + expect(result).toMatch(/abstract class Animal/) |
| 17 | + expect(result).toMatch(/class Point/) |
| 18 | + expect(result).toMatch(/const Point\(\)/) |
| 19 | + expect(result).toMatch(/Point\.named\(\)/) |
| 20 | + expect(result).toMatch(/factory Point\.origin\(\)/) |
| 21 | + expect(result).toMatch(/int get x/) |
| 22 | + expect(result).toMatch(/set x\(int value\)/) |
| 23 | + expect(result).toMatch(/Point operator \+/) |
| 24 | + expect(result).toMatch(/mixin Runner/) |
| 25 | + expect(result).toMatch(/enum Status/) |
| 26 | + expect(result).toMatch(/const Status\(\)/) |
| 27 | + expect(result).toMatch(/class Dog extends Animal with Runner/) |
| 28 | + expect(result).toMatch(/extension StringTools on String/) |
| 29 | + expect(result).toMatch(/extension type UserId/) |
| 30 | + expect(result).toMatch(/typedef Operation/) |
| 31 | + expect(result).toMatch(/int get answer/) |
| 32 | + expect(result).toMatch(/set answer\(int value\)/) |
| 33 | + expect(result).toMatch(/String speak\(\)/) |
| 34 | + expect(result).toMatch(/int add\(int left, int right\)/) |
| 35 | + }) |
| 36 | +}) |
0 commit comments