Skip to content

Commit 07c7447

Browse files
committed
Add test
1 parent 1582d50 commit 07c7447

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

tests/source/one_line_if.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ fn paren_if(x: bool) -> u8 {
1111
}
1212

1313
fn let_if(x: bool) -> u8 {
14-
let x = if x { 0 } else { 1 };
14+
let x = if x {
15+
foo()
16+
} else {
17+
bar()
18+
};
1519
x
1620
}
1721

@@ -22,3 +26,15 @@ fn return_if(x: bool) -> u8 {
2226
1
2327
};
2428
}
29+
30+
fn multi_if() {
31+
use std::io;
32+
if x { foo() } else { bar() }
33+
if x { foo() } else { bar() }
34+
}
35+
36+
fn middle_if() {
37+
use std::io;
38+
if x { foo() } else { bar() }
39+
let x = 1;
40+
}

tests/target/one_line_if.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,30 @@ fn paren_if(x: bool) -> u8 {
77
}
88

99
fn let_if(x: bool) -> u8 {
10-
let x = if x { 0 } else { 1 };
10+
let x = if x { foo() } else { bar() };
1111
x
1212
}
1313

1414
fn return_if(x: bool) -> u8 {
1515
return if x { 0 } else { 1 };
1616
}
17+
18+
fn multi_if() {
19+
use std::io;
20+
if x {
21+
foo()
22+
} else {
23+
bar()
24+
}
25+
if x { foo() } else { bar() }
26+
}
27+
28+
fn middle_if() {
29+
use std::io;
30+
if x {
31+
foo()
32+
} else {
33+
bar()
34+
}
35+
let x = 1;
36+
}

0 commit comments

Comments
 (0)