File tree Expand file tree Collapse file tree 1 file changed +30
-27
lines changed Expand file tree Collapse file tree 1 file changed +30
-27
lines changed Original file line number Diff line number Diff line change @@ -619,33 +619,36 @@ requested, and the second is post-processed pattern that should result.
619619There's no need for a "failure" test suite here, because we
620620demand exact results for every test case.
621621
622- Here is an example (expressed in YAML format):
623-
624- ~~~~ yaml
625- preprocessing :
626- -
627- - |-
628- [\n\r]+
629- - " "
630- -
631- - |-
632- [ \t]+\\s\+[ \t]+
633- - " \\ s+"
634- -
635- - |-
636- (\\s\*)?[ \t]+(\\s\*)?
637- - " \\ s*"
638- preprocessingTests :
639- -
640- - |-
641- \s* console \. log \( (["'`])Hello,\x20world!\1 \) ; \s*
642- - |-
643- \s*console\s*\.\s*log\s*\(\s*(["'`])Hello,\x20world!\1\s*\)\s*;\s*
644- -
645- - |-
646- \s* foo \s+ bar \\string\\ \s*
647- - |-
648- \s*foo\s+bar\s*\\string\\\s*
622+ Here is an example:
623+
624+ ~~~~ javascript
625+ preprocessing: [
626+ [
627+ // Ignore newlines
628+ String .raw ` [\n\r ]+` ,
629+ " "
630+ ],
631+ [
632+ // Convert \s+ surrounded by tabs/spaces as \s+ (optimization)
633+ String .raw ` [ \t ]+\\ s\+ [ \t ]+` ,
634+ String .raw ` \s +`
635+ ],
636+ [
637+ // Convert 1+ spaces/tabs, optionally surrounded by \s*, as \s*
638+ String .raw ` (\\ s\* )?[ \t ]+(\\ s\* )?` ,
639+ String .raw ` \s *`
640+ ]
641+ ],
642+ preprocessingTests: [
643+ [
644+ String .raw ` \s * console \. log \( (["'${ BACKQUOTE } ])Hello,\x20 world!\1 \) ; \s *` ,
645+ String .raw ` \s *console\s *\.\s *log\s *\(\s *(["'${ BACKQUOTE } ])Hello,\x20 world!\1\s *\)\s *;\s *`
646+ ],
647+ [
648+ String .raw ` \s * foo \s + bar \\ string\\ \s *` ,
649+ String .raw ` \s *foo\s +bar\s *\\ string\\\s *`
650+ ]
651+ ]
649652~~~~
650653
651654Here is an explanation of each of these preprocessing elements
You can’t perform that action at this time.
0 commit comments