Skip to main content
Glama
MIT License
27,120
19,787
  • Linux
  • Apple
parseFile.solidity.test.tsâ€Ē2.66 kB
import { beforeAll, describe, expect, test } from 'vitest'; import type { RepomixConfigMerged } from '../../../src/config/configSchema.js'; import { LanguageParser } from '../../../src/core/treeSitter/languageParser.js'; import { parseFile } from '../../../src/core/treeSitter/parseFile.js'; import { createMockConfig } from '../../testing/testUtils.js'; describe('Solidity File Parsing', () => { let parser: LanguageParser; const defaultConfig: RepomixConfigMerged = createMockConfig({ cwd: process.cwd(), input: { maxFileSize: 50 * 1024 * 1024, }, output: { filePath: 'output.txt', style: 'xml', stdout: false, parsableStyle: false, fileSummary: true, directoryStructure: true, removeComments: false, removeEmptyLines: false, compress: false, topFilesLength: 5, showLineNumbers: false, copyToClipboard: false, files: true, git: { sortByChanges: true, sortByChangesMaxCommits: 100, includeDiffs: false, }, }, include: [], ignore: { useGitignore: true, useDefaultPatterns: true, customPatterns: [], }, security: { enableSecurityCheck: true, }, tokenCount: { encoding: 'o200k_base', }, }); beforeAll(async () => { parser = new LanguageParser(); await parser.init(); }); test('should parse Solidity contract definitions correctly', async () => { const content = ` contract BaseContract { uint256 internal value; } interface IMyInterface { function getValue() external view returns (uint256); } abstract contract AbstractContract { function abstractFunction() virtual external; } contract MyContract is BaseContract, IMyInterface { function getValue() external view override returns (uint256) { return value; } }`; const config = { ...defaultConfig, output: { ...defaultConfig.output, removeComments: true, }, }; const result = await parseFile(content, 'test.sol', config); // 各įĻŪã‚ģãƒģトãƒĐã‚ŊトåۚįūĐがäŋæŒã•れãĶいるこãĻをįĒščŠ expect(result).toContain('contract BaseContract {'); expect(result).toContain('interface IMyInterface {'); expect(result).toContain('abstract contract AbstractContract {'); expect(result).toContain('contract MyContract is BaseContract, IMyInterface {'); // é–Ē数åۚįūĐがäŋæŒã•れãĶいるこãĻをįĒščŠ expect(result).toContain('function getValue() external view returns (uint256)'); expect(result).toContain('function abstractFunction() virtual external'); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yamadashy/repomix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server