aboutsummaryrefslogtreecommitdiff
path: root/tests/icon/accept/branch_edit.zc
blob: b360a6aadf6a769a9fdeb40f11911e8ce3189ffb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
include rt;
include run;
include icon;
fn main() {
	let q = run.tokens("if (1) { return 7; } else { return 9; }");
	let pattern = run.tokens("if ($expr:condition) { $stmt:yes } else { $stmt:no }");
	let replacement = run.tokens("if ($condition) { $no } else { $yes }");
	let edited = icon.rewrite(q, pattern, replacement);
	rt.put_n(run.eval(edited)); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10);
	return 0;
}