From 3c693d0d68a25213985e0a3a3c8817326d650001 Mon Sep 17 00:00:00 2001 From: damc Date: Tue, 26 Jul 2022 11:48:36 +0200 Subject: [PATCH] ppTests resetall --- sv-parser-pp/src/preprocess.rs | 17 +++++++++++++++++ sv-parser-pp/testcases/resetall.sv | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 sv-parser-pp/testcases/resetall.sv diff --git a/sv-parser-pp/src/preprocess.rs b/sv-parser-pp/src/preprocess.rs index 1760b97..805db4a 100644 --- a/sv-parser-pp/src/preprocess.rs +++ b/sv-parser-pp/src/preprocess.rs @@ -1551,6 +1551,23 @@ mod tests { ); } // }}} + #[test] + fn resetall() { // {{{ + let include_paths = [testfile_path("")]; + let (ret, _) = preprocess( + testfile_path("resetall.sv"), + &HashMap::new(), + &include_paths, + false, + false, + ) + .unwrap(); + assert_eq!( + ret.text(), + testfile_contents("resetall.sv") + ); + } // }}} + #[test] fn timescale() { // {{{ let include_paths = [testfile_path("")]; diff --git a/sv-parser-pp/testcases/resetall.sv b/sv-parser-pp/testcases/resetall.sv new file mode 100644 index 0000000..b81eb90 --- /dev/null +++ b/sv-parser-pp/testcases/resetall.sv @@ -0,0 +1,16 @@ +// IEEE1800-2017 Clause 22.3 +// When `resetall compiler directive is encountered during compilation, all +// compiler directives are set to the default values. This is useful for +// ensuring that only directives that are desired in compiling a particular +// source file are active. +// The recommended usage is to place `resetall at the beginning of each source +// text file, followed immediately by the directives desired in the file. +// It shall be illegal for the `resetall directive to be specified within +// a design element. +// Not all compiler directives have a default value (e.g., `define and +// `include). Directives that do not have a default are not affected by +// `resetall. +`resetall // Comment +`resetall// Comment +`resetall +// This file should be emitted from the preprocessor unchanged.