Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/parser/test/node/getStructure.rust.spec.ts
13405 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { afterAll, describe, expect, test } from 'vitest';
7
import { _dispose } from '../../node/parserImpl';
8
import { WASMLanguage } from '../../node/treeSitterLanguages';
9
import { fromFixture, snapshotPathInFixture, srcWithAnnotatedStructure } from './getStructure.util';
10
11
describe('getStructure - rust', () => {
12
afterAll(() => _dispose());
13
14
function rustStruct(source: string) {
15
return srcWithAnnotatedStructure(WASMLanguage.Rust, source);
16
}
17
18
test('source with different syntax constructs', async () => {
19
20
const file = 'test.rs';
21
22
const source = await fromFixture(file);
23
24
await expect(await rustStruct(source)).toMatchFileSnapshot(snapshotPathInFixture(file));
25
});
26
27
});
28
29