Skip to content

Commit

Permalink
Pure grammar test
Browse files Browse the repository at this point in the history
  • Loading branch information
goetzrrGit committed Dec 10, 2024
1 parent bf0f43b commit c20e281
Show file tree
Hide file tree
Showing 2 changed files with 918 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/utilities/codemirror/satf/sasf.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { testTree } from '@lezer/generator/dist/test';
import { describe, expect, it } from 'vitest';
import { SatfLanguage } from './satf';

const satfTest = [
[
'Empty SASF',
`
$$EOH
$$EOD
$$EOF
`,
`satf_sasf(Sasf(
Header,
Body
))`,
],
[
'Sample SASF',
`
$$EOH
$$EOD
request(VFT2_REQUEST_01,
START_TIME, 2024-266T19:59:57,
REQUESTOR, "vft2_anichola",
PROCESSOR, "VC2AB",
KEY, "No_Key")
command(1,
SCHEDULED_TIME,\\00:00:01\\,FROM_PREVIOUS_START,
COMMENT,\\"VFT2_short_name : sada_pause_test_main_seq",
"VFT2_full_name : psy.abs.vc2ab.sada_pause_test_main_seq.r02",
"VFT2_onboard_name: sada_pause_test_main_seq",
"VFT2_product_type: load_and_go_abs",
"VFT2_pce : AB",
"VFT2_vc : 2",
"cumulative_time is 1 sec (2024-266T19:59:58)"\\,
FILE_REMOVE("/eng/seq/sada_pause_test_main_seq.abs")
)
end
$$EOF`,
`satf_sasf(Sasf(Header,
Body(
Requests(
Request(RequestName,Time,Requestor,Processor,Key,
Steps(Command(StepLabel,ScheduledTime(Time,TimeRelation),
Comment,Stem,Args(String))))))))`,
],
];

describe('SASF Grammar test', () => {
satfTest.forEach((testcase: string[]) => {
it(testcase[0], () => {
const input = testcase[1];
expect(testTree(SatfLanguage.parser.parse(input), testcase[2], undefined)).toBeUndefined();
});
});
});
Loading

0 comments on commit c20e281

Please sign in to comment.