From edf66849ea1cfd9290182f8f071cf2e8aa2d64f9 Mon Sep 17 00:00:00 2001 From: damc Date: Tue, 26 Jul 2022 13:30:33 +0200 Subject: [PATCH] ppTests Add missing undefineall test. --- sv-parser-pp/src/preprocess.rs | 17 +++++++++++++++++ sv-parser-pp/testcases/expected/undefineall.sv | 16 ++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/sv-parser-pp/src/preprocess.rs b/sv-parser-pp/src/preprocess.rs index 2793f1f..adc4303 100644 --- a/sv-parser-pp/src/preprocess.rs +++ b/sv-parser-pp/src/preprocess.rs @@ -1645,4 +1645,21 @@ mod tests { testfile_contents("expected/undef.sv") ); } // }}} + + #[test] + fn undefineall() { // {{{ + let include_paths = [testfile_path("")]; + let (ret, _) = preprocess( + testfile_path("undefineall.sv"), + &HashMap::new(), + &include_paths, + false, + false, + ) + .unwrap(); + assert_eq!( + ret.text(), + testfile_contents("expected/undefineall.sv") + ); + } // }}} } diff --git a/sv-parser-pp/testcases/expected/undefineall.sv b/sv-parser-pp/testcases/expected/undefineall.sv index c711d39..9e5be19 100644 --- a/sv-parser-pp/testcases/expected/undefineall.sv +++ b/sv-parser-pp/testcases/expected/undefineall.sv @@ -1,11 +1,11 @@ -// IEEE1800-2017 Clause 22.5.2 -// The directive `undef shall undefine the specified text macro if previously -// defined by a `define compiler directive within the compilation unit. An -// attempt to undefine a text macro that was not previously defined using a -// `define compiler directive can issue a warning. -`undef FOO -`undef FOO// Comment -`undef FOO // Comment +// IEEE1800-2017 Clause 22.5.3 +// The directive `undefineall directive shall undefine all text macros +// previously defined by `define compiler directives within the compilation +// unit. This directive takes no argument and may appear anywhere in the source +// description. +`undefineall +`undefineall// Comment +`undefineall // Comment `define FOO foo `define BAR bar