-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'compact-control-readability-style'
- Loading branch information
Showing
11 changed files
with
173 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#Project properties | ||
#Fri May 27 11:12:53 BST 2011 | ||
#Project properties | ||
#Tue Jun 28 09:54:49 EDT 2011 | ||
plugin.uptodate=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
scalariform/src/test/scala/scalariform/formatter/CompactControlReadabilityTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package scalariform.formatter | ||
|
||
import preferences.FormattingPreferences._ | ||
import scalariform.formatter.preferences._ | ||
import scalariform.parser._ | ||
import scalariform.formatter._ | ||
|
||
// format: OFF | ||
class CompactControlReadabilityTest extends AbstractExpressionFormatterTest { | ||
|
||
implicit val formattingPreferences = FormattingPreferences.setPreference(CompactControlReadability, true) | ||
|
||
"""if(a){ | ||
|foo | ||
|} else { | ||
|bar }""" ==> | ||
"""if (a) { | ||
| foo | ||
|} | ||
|else { | ||
| bar | ||
|}""" | ||
|
||
"""if(a){ | ||
|foo | ||
|} | ||
|else { | ||
|bar }""" ==> | ||
"""if (a) { | ||
| foo | ||
|} | ||
|else { | ||
| bar | ||
|}""" | ||
|
||
"""if(a){ | ||
|foo | ||
|} else { | ||
| | ||
|bar }""" ==> | ||
"""if (a) { | ||
| foo | ||
|} | ||
|else { | ||
| | ||
| bar | ||
|}""" | ||
|
||
"""try{ | ||
| foo | ||
|} catch { | ||
| bar | ||
|}""" ==> | ||
"""try { | ||
| foo | ||
|} | ||
|catch { | ||
| bar | ||
|}""" | ||
|
||
"""try{ | ||
| foo | ||
|} finally { | ||
| bar | ||
|}""" ==> | ||
"""try { | ||
| foo | ||
|} | ||
|finally { | ||
| bar | ||
|}""" | ||
|
||
"""try{ | ||
| foo | ||
|} | ||
|finally { | ||
| bar | ||
|}""" ==> | ||
"""try { | ||
| foo | ||
|} | ||
|finally { | ||
| bar | ||
|}""" | ||
|
||
"""try{ | ||
| foo | ||
|} finally { | ||
| | ||
| bar | ||
|}""" ==> | ||
"""try { | ||
| foo | ||
|} | ||
|finally { | ||
| | ||
| bar | ||
|}""" | ||
|
||
"if (y > 0) positive else if (y < 0) negative else zero" ==> "if (y > 0) positive else if (y < 0) negative else zero" | ||
|
||
"try x catch y finally z" ==> "try x catch y finally z" | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters