ppErrorPreprocess Add testcase, currently ignored.

This commit is contained in:
damc 2022-10-26 20:14:19 +02:00
parent f9e93d18bd
commit 8c3f87b360
3 changed files with 106 additions and 0 deletions

View File

@ -1409,6 +1409,16 @@ mod tests {
);
} // }}}
#[test]
#[ignore = "Exposes unfixed PP parser bug."]
fn macro_comment_embedded() { // {{{
let (ret, _) = preprocess_usualargs("macro_comment_embedded.sv").unwrap();
assert_eq!(
ret.text(),
testfile_contents("expected/macro_comment_embedded.sv")
);
} // }}}
#[test]
fn macro_delimiters() { // {{{
let (ret, _) = preprocess_usualargs("macro_delimiters.sv").unwrap();

View File

@ -0,0 +1,54 @@
// Unusual case where a preprocessor comment (same symbol as a single-line
// comment, "//") is embedded in an emitted C-style comment.
// This should not preprocess, but not parse, i.e. in the emitted text, there
// will be an opening // C-style comment symbol "/*" but no closing symbol "*/".
`define A \
A1 \
A2 /* emitted */ \
A3 /* // not emitted, unclosed C comment */ \
A4
// Same as A, but without space before "//".
// This may catch bad parsers where the first "/" in "//" is treated as part of
// the closing "*/".
`define B \
B1 \
B2 /* emitted */ \
B3 /*// not emitted, unclosed C comment */ \
B4
// Another variation on B.
`define C \
C1 \
C2 /* emitted */ \
C3 //* not emitted, not a C comment */ \
C4
// Another variation on B.
`define D \
D1 \
D2 /* emitted */ \
D3 /* emitted, unclosed C comment *// \
D4
A1
A2 /* emitted */
A3 /*
A4
B1
B2 /* emitted */
B3 /*
B4
C1
C2 /* emitted */
C3 //
C4
D1
D2 /* emitted */
D3 /* emitted, unclosed C comment *
D4

View File

@ -0,0 +1,42 @@
// Unusual case where a preprocessor comment (same symbol as a single-line
// comment, "//") is embedded in an emitted C-style comment.
// This should not preprocess, but not parse, i.e. in the emitted text, there
// will be an opening // C-style comment symbol "/*" but no closing symbol "*/".
`define A \
A1 \
A2 /* emitted */ \
A3 /* // not emitted, unclosed C comment */ \
A4
// Same as A, but without space before "//".
// This may catch bad parsers where the first "/" in "//" is treated as part of
// the closing "*/".
`define B \
B1 \
B2 /* emitted */ \
B3 /*// not emitted, unclosed C comment */ \
B4
// Another variation on B.
`define C \
C1 \
C2 /* emitted */ \
C3 //* not emitted, C comment is closed */ \
C4
// Another variation on B.
`define D \
D1 \
D2 /* emitted */ \
D3 /* emitted, unclosed C comment *// \
D4
`A
`B
`C
`D