use std::process::Command;
const WORKSPACE_ROOT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../..");
fn build_example(name: &str, features: &str) -> bool {
let mut args = vec!["build", "--quiet", "-p", "oxiui", "--example", name];
let feat_str;
if !features.is_empty() {
feat_str = features.to_owned();
args.push("--features");
args.push(&feat_str);
}
let status = Command::new("cargo")
.args(&args)
.current_dir(WORKSPACE_ROOT)
.status();
match status {
Ok(s) => s.success(),
Err(_) => true,
}
}
#[test]
fn example_hello_compiles() {
assert!(build_example("hello", ""), "example 'hello' must compile");
}
#[test]
fn example_hello_iced_compiles() {
assert!(
build_example("hello_iced", "iced"),
"example 'hello_iced' must compile"
);
}
#[test]
fn example_hello_table_compiles() {
assert!(
build_example("hello_table", "table"),
"example 'hello_table' must compile"
);
}