ppTests macro_FILE

This commit is contained in:
damc 2022-07-25 22:08:03 +02:00
parent 2e77dbc38a
commit f85809f55a
3 changed files with 54 additions and 0 deletions

View File

@ -1362,6 +1362,23 @@ mod tests {
); );
} // }}} } // }}}
#[test]
#[allow(non_snake_case)]
fn macro_FILE() { // {{{
let (ret, _) = preprocess(
testfile_path("macro_FILE.sv"),
&HashMap::new(),
&[] as &[String],
false,
false,
)
.unwrap();
assert_eq!(
ret.text(),
testfile_contents("expected/macro_FILE.sv")
);
} // }}}
#[test] #[test]
fn macro_multiline_comment() { // {{{ fn macro_multiline_comment() { // {{{
let (ret, _) = preprocess( let (ret, _) = preprocess(

View File

@ -0,0 +1,13 @@
// __FILE__ = `__FILE__
// This block SHOULD be emitted from the preprocessor.
// Emitted instead.
// The following define should have no effect.
`define __FILE__ "FOO"
// The following undef should have no effect.
// NOTE: Comparison against expected value are destined to fail in testcase.

View File

@ -0,0 +1,24 @@
// __FILE__ = `__FILE__
`ifdef __FILE__
// This block SHOULD be emitted from the preprocessor.
`elsif UNDEFINED
// NOT emitted.
`endif
`ifndef __FILE__
// This block should NOT be emitted from the preprocessor.
// However, following (conditional) definition should make it through the
// preprocessor parsing stage without error.
`define __FILE__ "(null)"
`elsif UNDEFINED
// Emitted instead.
`endif
// The following define should have no effect.
`define __FILE__ "FOO"
// The following undef should have no effect.
`undef __FILE__
// NOTE: Comparison against expected value are destined to fail in testcase.