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:
parent
8e461d0de6
commit
da6157952e
@ -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");
|
||||||
|
9
sv-parser-pp/testcases/expected/include_quoted_c.sv
Normal file
9
sv-parser-pp/testcases/expected/include_quoted_c.sv
Normal 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
|
8
sv-parser-pp/testcases/expected/include_quoted_d.sv
Normal file
8
sv-parser-pp/testcases/expected/include_quoted_d.sv
Normal 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
|
5
sv-parser-pp/testcases/include_quoted_a.sv
Normal file
5
sv-parser-pp/testcases/include_quoted_a.sv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
`define PATH included.svh
|
||||||
|
`define QUOTE(path) `"path`"
|
||||||
|
module and_op (a, b, c);
|
||||||
|
`include `QUOTE(`PATH)
|
||||||
|
endmodule
|
5
sv-parser-pp/testcases/include_quoted_b.sv
Normal file
5
sv-parser-pp/testcases/include_quoted_b.sv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
`define PATH included.svh
|
||||||
|
`define QUOTED_PATH `"`PATH`"
|
||||||
|
module and_op (a, b, c);
|
||||||
|
`include `QUOTED_PATH
|
||||||
|
endmodule
|
5
sv-parser-pp/testcases/include_quoted_c.sv
Normal file
5
sv-parser-pp/testcases/include_quoted_c.sv
Normal 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
|
4
sv-parser-pp/testcases/include_quoted_d.sv
Normal file
4
sv-parser-pp/testcases/include_quoted_d.sv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
`define PATH "included.svh"
|
||||||
|
module and_op (a, b, c);
|
||||||
|
`include `PATH
|
||||||
|
endmodule
|
Loading…
x
Reference in New Issue
Block a user