mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00

Use has_error() and a new convenience function to get the diagnostics as a string vector.
18 lines
479 B
Rust
18 lines
479 B
Rust
use std::error::Error;
|
|
|
|
pub fn test(testcase: &test_driver_lib::TestCase) -> Result<(), Box<dyn Error>> {
|
|
let source = std::fs::read_to_string(&testcase.absolute_path)?;
|
|
|
|
let component = match sixtyfps_interpreter::load(source, &testcase.absolute_path) {
|
|
Ok(c) => c,
|
|
Err(diag) => {
|
|
let vec = diag.to_string_vec();
|
|
diag.print();
|
|
return Err(vec.join("\n").into());
|
|
}
|
|
};
|
|
|
|
component.create();
|
|
|
|
Ok(())
|
|
}
|