UPDATE: Add templates

This commit is contained in:
Nicolás Hatcher
2025-09-28 12:26:13 +02:00
committed by Nicolás Hatcher Andrés
parent 3e9c69f122
commit fdeae2c771
4 changed files with 42 additions and 3 deletions

View File

@@ -717,7 +717,7 @@ impl Parser {
return Node::ParseErrorKind { return Node::ParseErrorKind {
formula: self.lexer.get_formula(), formula: self.lexer.get_formula(),
position: 0, position: 0,
message: "sheet not found".to_string(), message: format!("sheet not found: {}", context.sheet),
}; };
} }
}; };
@@ -850,7 +850,7 @@ impl Parser {
return Node::ParseErrorKind { return Node::ParseErrorKind {
formula: self.lexer.get_formula(), formula: self.lexer.get_formula(),
position: 0, position: 0,
message: "sheet not found".to_string(), message: format!("sheet not found: {}", context.sheet),
}; };
} }
}; };
@@ -878,7 +878,7 @@ impl Parser {
return Node::ParseErrorKind { return Node::ParseErrorKind {
formula: self.lexer.get_formula(), formula: self.lexer.get_formula(),
position: 0, position: 0,
message: "sheet not found".to_string(), message: format!("table sheet not found: {}", table.sheet_name),
}; };
} }
}; };

Binary file not shown.

Binary file not shown.

View File

@@ -472,6 +472,45 @@ fn test_exporting_merged_cells() {
fs::remove_file(temp_file_name).unwrap(); fs::remove_file(temp_file_name).unwrap();
} }
#[test]
fn test_templates_xlsx() {
let mut entries = fs::read_dir("tests/templates/")
.unwrap()
.map(|res| res.map(|e| e.path()))
.collect::<Result<Vec<_>, io::Error>>()
.unwrap();
entries.sort();
let temp_folder = env::temp_dir();
let path = format!("{}", Uuid::new_v4());
let dir = temp_folder.join(path);
fs::create_dir(&dir).unwrap();
let mut is_error = false;
for file_path in entries {
let file_name_str = file_path.file_name().unwrap().to_str().unwrap();
let file_path_str = file_path.to_str().unwrap();
println!("Testing file: {file_path_str}");
if file_name_str.ends_with(".xlsx") && !file_name_str.starts_with('~') {
if let Err(message) = test_file(file_path_str) {
println!("Error with file: '{file_path_str}'");
println!("{message}");
is_error = true;
}
let t = test_load_and_saving(file_path_str, &dir);
if t.is_err() {
println!("Error while load and saving file: {file_path_str}");
is_error = true;
}
} else {
println!("skipping");
}
}
fs::remove_dir_all(&dir).unwrap();
assert!(
!is_error,
"Models were evaluated inconsistently with XLSX data."
);
}
#[test] #[test]
fn test_documentation_xlsx() { fn test_documentation_xlsx() {
let mut entries = fs::read_dir("tests/docs/") let mut entries = fs::read_dir("tests/docs/")