ppTests include_origin,include_ignore

This commit is contained in:
damc 2022-07-21 12:15:52 +02:00
parent c64a151583
commit c78276b906
5 changed files with 10 additions and 7 deletions

View File

@ -916,7 +916,7 @@ mod tests {
fn include_origin() { fn include_origin() {
let include_paths = [testfile_path("")]; let include_paths = [testfile_path("")];
let (ret, _) = preprocess( let (ret, _) = preprocess(
testfile_path("test2.sv"), testfile_path("include_origin.sv"),
&HashMap::new(), &HashMap::new(),
&include_paths, &include_paths,
false, false,
@ -925,11 +925,11 @@ mod tests {
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
ret.text(), ret.text(),
testfile_contents("expected/include_origin") testfile_contents("expected/include_origin.sv")
); );
assert_eq!( assert_eq!(
ret.origin(10).unwrap().0, ret.origin(10).unwrap().0,
&PathBuf::from(testfile_path("test2.sv")) &PathBuf::from(testfile_path("include_origin.sv"))
); );
assert_eq!(ret.origin(10).unwrap().1, 10); assert_eq!(ret.origin(10).unwrap().1, 10);
assert_eq!( assert_eq!(
@ -939,16 +939,16 @@ mod tests {
assert_eq!(ret.origin(50).unwrap().1, 73); assert_eq!(ret.origin(50).unwrap().1, 73);
assert_eq!( assert_eq!(
ret.origin(70).unwrap().0, ret.origin(70).unwrap().0,
&PathBuf::from(testfile_path("test2.sv")) &PathBuf::from(testfile_path("include_origin.sv"))
); );
assert_eq!(ret.origin(70).unwrap().1, 50); assert_eq!(ret.origin(70).unwrap().1, 50);
} }
#[test] #[test]
fn ignore_include() { fn include_ignore() {
let include_paths = [testfile_path("")]; let include_paths = [testfile_path("")];
let (ret, _) = preprocess( let (ret, _) = preprocess(
testfile_path("test2.sv"), testfile_path("include_ignore.sv"),
&HashMap::new(), &HashMap::new(),
&include_paths, &include_paths,
false, false,
@ -957,7 +957,7 @@ mod tests {
.unwrap(); .unwrap();
assert_eq!( assert_eq!(
ret.text(), ret.text(),
testfile_contents("expected/ignore_include") testfile_contents("expected/include_ignore.sv")
); );
} }

View File

@ -0,0 +1,3 @@
module and_op (a, b, c);
`include "test2.svh"
endmodule