fn run_app_on_simulator() {
    println!("Running app");
    let output = t!(Command::new("xcrun")
                    .arg("simctl")
                    .arg("launch")
                    .arg("--console")
                    .arg("booted")
                    .arg("com.rust.unittests")
                    .output());

    println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
    println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));

    let stdout = String::from_utf8_lossy(&output.stdout);
    let failed = stdout.lines()
        .find(|l| l.contains("FAILED"))
        .map(|l| l.contains("FAILED"))
        .unwrap_or(false);

    let passed = stdout.lines()
        .find(|l| l.contains("test result: ok"))
        .map(|l| l.contains("test result: ok"))
        .unwrap_or(false);

    println!("Shutting down simulator");
    Command::new("xcrun")
        .arg("simctl")
        .arg("shutdown")
        .arg("rust_ios")
        .check_status();
    if !(passed && !failed) {
        panic!("tests didn't pass");
    }
}
// Step four: Run the app
Step four: Run the app
Step four : Run the app
fn run_app_on_simulator() {
    println!("Running app");
    let output = t!(Command::new("xcrun")
                    .arg("simctl")
                    .arg("launch")
                    .arg("--console")
                    .arg("booted")
                    .arg("com.rust.unittests")
                    .output());
    println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
    println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
    let stdout = String::from_utf8_lossy(&output.stdout);
    let failed = stdout.lines()
        .find(|l| l.contains("FAILED"))
        .map(|l| l.contains("FAILED"))
        .unwrap_or(false);
    let passed = stdout.lines()
        .find(|l| l.contains("test result: ok"))
        .map(|l| l.contains("test result: ok"))
        .unwrap_or(false);
    println!("Shutting down simulator");
    Command::new("xcrun")
        .arg("simctl")
        .arg("shutdown")
        .arg("rust_ios")
        .check_status();
    if !(passed && !failed) {
        panic!("tests didn't pass");
    }
}
fn run_app_on_simulator ( ) { println ! ( " " ) ; let output = t ! ( Command new ( " " ) arg ( " " ) arg ( " " ) arg ( " " ) arg ( " " ) arg ( " " ) output ( ) ) ; println ! ( " \n \n " String from_utf8_lossy ( output stdout ) ) ; println ! ( " \n \n " String from_utf8_lossy ( output stderr ) ) ; let stdout = String :: from_utf8_lossy ( & output . stdout ) ; let failed = stdout . lines ( ) . find ( | l | l . contains ( " " ) ) . map ( | l | l . contains ( " " ) ) . unwrap_or ( false ) ; let passed = stdout . lines ( ) . find ( | l | l . contains ( " " ) ) . map ( | l | l . contains ( " " ) ) . unwrap_or ( false ) ; println ! ( " " ) ; Command :: new ( " " ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . check_status ( ) ; if ! ( passed && ! failed ) { panic ! ( " " ) ; } }
Step four: Run the app
Step four : Run the app