import {createTest} from '@putout/test/processor'; import {montag} from 'montag'; import {branch, merge} from '../lib/toml.js'; const test = createTest(import.meta.url, { extension: 'toml', processors: ['toml'], }); test('putout: processor: toml', async ({noProcess}) => { await noProcess('bunfig'); }); test('putout: processor: toml: bunfig', async ({comparePlaces}) => { await comparePlaces('bunfig', []); }); test('putout: processor: toml: duplicate', async ({comparePlaces}) => { await comparePlaces('duplicate', [{ position: { column: 0, line: 4, }, message: 'Table already defined: install', rule: 'toml-parse-error (toml)', }]); }); test('putout: processor: toml: merge: a couple items in list: not last', (t) => { const rawSource = montag` __putout_processor_toml({ "hello": { "world": "hello" } });\n `; const filesystem = montag` __putout_processor_filesystem({ "filename": "/", "files": [] });\n `; const list = [ filesystem, rawSource, filesystem, ]; const result = merge(rawSource, list); const expected = montag` [hello] world = "hello" ` + '\n'; t.equal(result, expected); t.end(); }); test('putout: processor: toml: merge: no change', (t) => { const rawSource = montag` extend-exclude = ["ChangeLog"] `; const [{source}] = branch(rawSource); const result = merge(rawSource, [source]); const expected = montag` extend-exclude = ["ChangeLog"] ` + '\n'; t.equal(result, expected); t.end(); }); test('putout: processor: toml: no report: quotes', async ({comparePlaces}) => { await comparePlaces('quotes', []); });