ppTests macro_FILE
This commit is contained in:
parent
2e77dbc38a
commit
f85809f55a
@ -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]
|
||||
fn macro_multiline_comment() { // {{{
|
||||
let (ret, _) = preprocess(
|
||||
|
13
sv-parser-pp/testcases/expected/macro_FILE.sv
Normal file
13
sv-parser-pp/testcases/expected/macro_FILE.sv
Normal 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.
|
24
sv-parser-pp/testcases/macro_FILE.sv
Normal file
24
sv-parser-pp/testcases/macro_FILE.sv
Normal 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.
|
Loading…
x
Reference in New Issue
Block a user