mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 13:24:48 +00:00

This uses the recently added "hooks" or APIs to pass an include path that's specified in the test case itself.
23 lines
641 B
Rust
23 lines
641 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 include_paths = &test_driver_lib::extract_include_paths(&source)
|
|
.map(std::path::PathBuf::from)
|
|
.collect::<Vec<_>>();
|
|
|
|
let component = match sixtyfps_interpreter::load(source, &testcase.absolute_path, include_paths)
|
|
{
|
|
Ok(c) => c,
|
|
Err(diag) => {
|
|
let vec = diag.to_string_vec();
|
|
diag.print();
|
|
return Err(vec.join("\n").into());
|
|
}
|
|
};
|
|
|
|
component.create();
|
|
|
|
Ok(())
|
|
}
|