const MAIN: &str = include_str!("../src/main.rs");
fn android_up_branch() -> &'static str {
let start = MAIN
.find("if platform == RunPlatform::Android {")
.expect("the Android branch of runner up moved or was renamed");
let rest = &MAIN[start..];
let end = rest
.find("return Ok(std::process::ExitCode::SUCCESS);")
.expect("the Android branch no longer returns early — re-read it before trusting this");
&rest[..end]
}
#[test]
fn the_branch_refuses_ios_only_flags_before_touching_adb() {
let branch = android_up_branch();
let call = branch.find("reject_ios_only_up_flags").expect(
"the Android branch does not refuse iOS-only flags — --bundle, --runner-project \
and --supervise would be accepted and silently dropped again",
);
let up = branch
.find("runner_android::up")
.expect("the Android branch no longer brings the runner up — re-read it");
assert!(
call < up,
"the refusal must come before runner_android::up, which starts with adb install: \
refusing after the install has already happened protects nothing"
);
}