2020-01-27 15:54:52 +00:00
|
|
|
use sv_filelist_parser;
|
2020-01-26 16:52:39 +00:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn simple_test() {
|
|
|
|
let mut defines = HashMap::new();
|
2020-01-30 16:14:45 +00:00
|
|
|
defines.insert("a".to_string(), Some("bad".to_string()));
|
|
|
|
defines.insert("e".to_string(), Some("f".to_string()));
|
|
|
|
defines.insert("c".to_string(), Some("d".to_string()));
|
|
|
|
defines.insert("ENV_VAR1".to_string(), Some("var1".to_string()));
|
|
|
|
defines.insert("ENV_VAR2".to_string(), Some("var2".to_string()));
|
|
|
|
defines.insert("RTL".to_string(), None);
|
2020-01-26 16:52:39 +00:00
|
|
|
|
2020-01-27 15:54:52 +00:00
|
|
|
let filelist_exp = sv_filelist_parser::Filelist {
|
2020-01-26 16:52:39 +00:00
|
|
|
files : vec!["testcase/file1.sv".to_string(),
|
|
|
|
"testcase/file2.sv".to_string(),
|
|
|
|
"testcase/file3.sv".to_string(),
|
|
|
|
"testcase/file4.sv".to_string(),],
|
|
|
|
incdirs : vec!["testcase/".to_string()],
|
|
|
|
defines : defines,
|
|
|
|
comments_present : true
|
|
|
|
};
|
2020-01-28 17:07:55 +00:00
|
|
|
|
|
|
|
// Add env vars
|
|
|
|
std::env::set_var("VAR1", "ENV_VAR1");
|
|
|
|
std::env::set_var("VAR2", "ENV_VAR2");
|
|
|
|
|
2020-01-26 16:52:39 +00:00
|
|
|
let filelist = sv_filelist_parser::parse("testcase/files.f")
|
|
|
|
.expect("Error parsing");
|
|
|
|
assert_eq!(filelist_exp, filelist);
|
|
|
|
}
|