@@ -521,47 +521,51 @@ final class IfStmtTests: PrettyPrintTestCase {
521
521
func testMultipleIfStmts( ) {
522
522
let input =
523
523
"""
524
- if foo && bar { baz() } else if bar { baz() } else if foo { baz() } else { blargh() }
525
- if foo && bar && quxxe { baz() } else if bar { baz() } else if foo { baz() } else if quxxe { baz() } else { blargh() }
526
- if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz { foo() } else { bar() }
527
- if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz && someOtherCondition { foo() } else { bar() }
528
- if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz && someOtherCondition { foo() }
524
+ func foo() {
525
+ if foo && bar { baz() } else if bar { baz() } else if foo { baz() } else { blargh() }
526
+ if foo && bar && quxxe { baz() } else if bar { baz() } else if foo { baz() } else if quxxe { baz() } else { blargh() }
527
+ if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz { foo() } else { bar() }
528
+ if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz && someOtherCondition { foo() } else { bar() }
529
+ if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz && someOtherCondition { foo() }
530
+ }
529
531
"""
530
532
531
533
let expected =
532
534
"""
533
- if foo && bar { baz() } else if bar { baz() } else if foo { baz() } else { blargh() }
534
- if foo && bar && quxxe {
535
- baz()
536
- } else if bar {
537
- baz()
538
- } else if foo {
539
- baz()
540
- } else if quxxe {
541
- baz()
542
- } else {
543
- blargh()
544
- }
545
- if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz {
546
- foo()
547
- } else {
548
- bar()
549
- }
550
- if let foo = getmyfoo(), let bar = getmybar(),
551
- foo.baz && bar.baz && someOtherCondition
552
- {
553
- foo()
554
- } else {
555
- bar()
556
- }
557
- if let foo = getmyfoo(), let bar = getmybar(),
558
- foo.baz && bar.baz && someOtherCondition
559
- {
560
- foo()
535
+ func foo() {
536
+ if foo && bar { baz() } else if bar { baz() } else if foo { baz() } else { blargh() }
537
+ if foo && bar && quxxe {
538
+ baz()
539
+ } else if bar {
540
+ baz()
541
+ } else if foo {
542
+ baz()
543
+ } else if quxxe {
544
+ baz()
545
+ } else {
546
+ blargh()
547
+ }
548
+ if let foo = getmyfoo(), let bar = getmybar(), foo.baz && bar.baz {
549
+ foo()
550
+ } else {
551
+ bar()
552
+ }
553
+ if let foo = getmyfoo(), let bar = getmybar(),
554
+ foo.baz && bar.baz && someOtherCondition
555
+ {
556
+ foo()
557
+ } else {
558
+ bar()
559
+ }
560
+ if let foo = getmyfoo(), let bar = getmybar(),
561
+ foo.baz && bar.baz && someOtherCondition
562
+ {
563
+ foo()
564
+ }
561
565
}
562
566
563
567
"""
564
568
565
- assertPrettyPrintEqual ( input: input, expected: expected, linelength: 85 )
569
+ assertPrettyPrintEqual ( input: input, expected: expected, linelength: 87 )
566
570
}
567
571
}
0 commit comments