mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
WIP
This commit is contained in:
parent
9fc60e104f
commit
46d7aaa2cb
3 changed files with 24 additions and 24 deletions
|
@ -17,7 +17,7 @@ impl Driver {
|
||||||
Ok(Self { native_library_dependencies: deps.split(" ").map(String::from).collect() })
|
Ok(Self { native_library_dependencies: deps.split(" ").map(String::from).collect() })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test(&self, testcase: &super::TestCase) -> Result<(), Box<dyn Error>> {
|
pub fn test(&self, testcase: &test_driver_lib::TestCase) -> Result<(), Box<dyn Error>> {
|
||||||
let (syntax_node, mut diag) = parser::parse(&testcase.source);
|
let (syntax_node, mut diag) = parser::parse(&testcase.source);
|
||||||
diag.current_path = testcase.path.clone();
|
diag.current_path = testcase.path.clone();
|
||||||
let mut tr = typeregister::TypeRegister::builtin();
|
let mut tr = typeregister::TypeRegister::builtin();
|
||||||
|
|
|
@ -1,33 +1,11 @@
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
pub struct TestCase {
|
|
||||||
pub source: String,
|
|
||||||
pub path: std::path::PathBuf,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn collect_test_cases() -> std::io::Result<Vec<TestCase>> {
|
|
||||||
let mut results = vec![];
|
|
||||||
|
|
||||||
for entry in std::fs::read_dir(format!("{}/../cases", env!("CARGO_MANIFEST_DIR")))? {
|
|
||||||
let entry = entry?;
|
|
||||||
let path = entry.path();
|
|
||||||
if let Some(ext) = path.extension() {
|
|
||||||
if ext == "60" {
|
|
||||||
let source = std::fs::read_to_string(&path)?;
|
|
||||||
results.push(TestCase { source, path });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(results)
|
|
||||||
}
|
|
||||||
|
|
||||||
mod cpp;
|
mod cpp;
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let cpp_driver = cpp::Driver::new()?;
|
let cpp_driver = cpp::Driver::new()?;
|
||||||
|
|
||||||
for testcase in collect_test_cases()? {
|
for testcase in test_driver_lib::collect_test_cases()? {
|
||||||
cpp_driver.test(&testcase)?;
|
cpp_driver.test(&testcase)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,3 +57,25 @@ pub fn native_library_dependencies(
|
||||||
|
|
||||||
Ok(native_library_dependencies.trim().into())
|
Ok(native_library_dependencies.trim().into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct TestCase {
|
||||||
|
pub source: String,
|
||||||
|
pub path: std::path::PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn collect_test_cases() -> std::io::Result<Vec<TestCase>> {
|
||||||
|
let mut results = vec![];
|
||||||
|
|
||||||
|
for entry in std::fs::read_dir(format!("{}/../cases", env!("CARGO_MANIFEST_DIR")))? {
|
||||||
|
let entry = entry?;
|
||||||
|
let path = entry.path();
|
||||||
|
if let Some(ext) = path.extension() {
|
||||||
|
if ext == "60" {
|
||||||
|
let source = std::fs::read_to_string(&path)?;
|
||||||
|
results.push(TestCase { source, path });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(results)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue