ppTests include_quoted_(a|b|c|d)

- Illustration of https://github.com/dalance/svlint/issues/77
- That's the same as https://github.com/dalance/sv-parser/issues/48
- A,B show what doesn't work, vaguely defined on page 680.
- C,D show what does work, using example on page 680.
This commit is contained in:
damc 2022-07-26 22:00:46 +02:00
parent 8e461d0de6
commit da6157952e
7 changed files with 66 additions and 0 deletions

View File

@ -1250,6 +1250,36 @@ mod tests {
assert_eq!(ret.text().chars().nth(n).unwrap(), 'o'); assert_eq!(ret.text().chars().nth(n).unwrap(), 'o');
} // }}} } // }}}
#[test]
fn include_quoted_a() { // {{{
let ret = preprocess_usualargs("include_quoted_a.sv");
assert_eq!(format!("{:?}", ret), "Err(Include { source: File { source: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }, path: \"`PATH\" } })");
} // }}}
#[test]
fn include_quoted_b() { // {{{
let ret = preprocess_usualargs("include_quoted_b.sv");
assert_eq!(format!("{:?}", ret), "Err(Include { source: File { source: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }, path: \"`PATH\" } })");
} // }}}
#[test]
fn include_quoted_c() { // {{{
let (ret, _) = preprocess_usualargs("include_quoted_c.sv").unwrap();
assert_eq!(
ret.text(),
testfile_contents("expected/include_quoted_c.sv")
);
} // }}}
#[test]
fn include_quoted_d() { // {{{
let (ret, _) = preprocess_usualargs("include_quoted_d.sv").unwrap();
assert_eq!(
ret.text(),
testfile_contents("expected/include_quoted_d.sv")
);
} // }}}
#[test] #[test]
fn include_recursive() { // {{{ fn include_recursive() { // {{{
let ret = preprocess_usualargs("include_recursive.svh"); let ret = preprocess_usualargs("include_recursive.svh");

View File

@ -0,0 +1,9 @@
// Based on last example of IEEE1800-2017 Clause 22.5.1, page 680.
`define APPEND_SVH(path) `"path.svh`"
module and_op (a, b, c);
output a;
input b, c;
and a1 (a,b,c);
endmodule

View File

@ -0,0 +1,8 @@
`define PATH "included.svh"
module and_op (a, b, c);
output a;
input b, c;
and a1 (a,b,c);
endmodule

View File

@ -0,0 +1,5 @@
`define PATH included.svh
`define QUOTE(path) `"path`"
module and_op (a, b, c);
`include `QUOTE(`PATH)
endmodule

View File

@ -0,0 +1,5 @@
`define PATH included.svh
`define QUOTED_PATH `"`PATH`"
module and_op (a, b, c);
`include `QUOTED_PATH
endmodule

View File

@ -0,0 +1,5 @@
// Based on last example of IEEE1800-2017 Clause 22.5.1, page 680.
`define APPEND_SVH(path) `"path.svh`"
module and_op (a, b, c);
`include `APPEND_SVH(included)
endmodule

View File

@ -0,0 +1,4 @@
`define PATH "included.svh"
module and_op (a, b, c);
`include `PATH
endmodule