2023-09-07 00:00:38 +03:00
|
|
|
import { describe, expect, it } from 'vitest';
|
2023-08-20 15:38:46 +03:00
|
|
|
|
2023-11-03 22:35:01 +03:00
|
|
|
import { Info } from '../src/language/index.js';
|
|
|
|
import { expectNoErrorsOrAlternatives, infoParse as parse } from './test-util.js';
|
2023-08-20 15:38:46 +03:00
|
|
|
|
|
|
|
describe('info', () => {
|
|
|
|
it.each([
|
|
|
|
`info`,
|
|
|
|
`
|
|
|
|
info`,
|
|
|
|
`info
|
|
|
|
`,
|
|
|
|
`
|
|
|
|
info
|
|
|
|
`,
|
|
|
|
])('should handle empty info', (context: string) => {
|
2023-08-26 14:01:56 +03:00
|
|
|
const result = parse(context);
|
2023-11-03 22:35:01 +03:00
|
|
|
expectNoErrorsOrAlternatives(result);
|
2023-08-26 14:01:56 +03:00
|
|
|
expect(result.value.$type).toBe(Info);
|
2023-08-20 15:38:46 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it.each([
|
|
|
|
`info showInfo`,
|
2023-11-03 22:35:01 +03:00
|
|
|
`info showInfo
|
|
|
|
`,
|
2023-08-20 15:38:46 +03:00
|
|
|
`
|
|
|
|
info showInfo`,
|
|
|
|
`info
|
2023-11-03 22:35:01 +03:00
|
|
|
showInfo`,
|
|
|
|
`info
|
2023-08-20 15:38:46 +03:00
|
|
|
showInfo
|
|
|
|
`,
|
|
|
|
`
|
|
|
|
info
|
|
|
|
showInfo
|
|
|
|
`,
|
2023-11-03 22:35:01 +03:00
|
|
|
`
|
|
|
|
info
|
|
|
|
showInfo`,
|
|
|
|
`
|
|
|
|
info showInfo
|
|
|
|
`,
|
2023-08-20 15:38:46 +03:00
|
|
|
])('should handle showInfo', (context: string) => {
|
2023-08-26 14:01:56 +03:00
|
|
|
const result = parse(context);
|
2023-11-03 22:35:01 +03:00
|
|
|
expectNoErrorsOrAlternatives(result);
|
2023-08-26 14:01:56 +03:00
|
|
|
expect(result.value.$type).toBe(Info);
|
2023-08-20 15:38:46 +03:00
|
|
|
});
|
|
|
|
});
|