-
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.
do not add newline for each function in
=> => =>
scenarios
resolves #45
- Loading branch information
Showing
2 changed files
with
60 additions
and
3 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
46 changes: 46 additions & 0 deletions
46
scalariform/src/test/scala/com/danieltrinh/scalariform/formatter/FunctionFormatterTest.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,46 @@ | ||
package com.danieltrinh.scalariform.formatter | ||
|
||
import com.danieltrinh.scalariform.parser.{CompilationUnit, ScalaParser} | ||
|
||
// format: OFF | ||
class FunctionFormatterTest extends AbstractFormatterTest { | ||
|
||
"val f = x => x" ==> "val f = x => x" | ||
"val f: Int => Int => Unit = a => b => ()" ==> "val f: Int => Int => Unit = a => b => ()" | ||
|
||
"{ ctx => j => () }" ==> "{ ctx => j => () }" | ||
"fun { ctx => j => () }" ==> "fun { ctx => j => () }" | ||
"Thing() { ctx => j => () }" ==> "Thing() { ctx => j => () }" | ||
|
||
"""{ ctx => | ||
| ??? | ||
|}""".stripMargin ==> | ||
"""{ ctx => | ||
| ??? | ||
|}""".stripMargin | ||
|
||
"""{ ctx => j => | ||
| ??? | ||
|}""".stripMargin ==> | ||
"""{ ctx => j => | ||
| ??? | ||
|}""".stripMargin | ||
|
||
"""val x = { ctx => j => | ||
| one() | ||
| two() | ||
|}""".stripMargin ==> | ||
"""val x = { ctx => j => | ||
| one() | ||
| two() | ||
|}""".stripMargin | ||
|
||
override val debug = false | ||
|
||
type Result = CompilationUnit | ||
|
||
def parse(parser: ScalaParser) = parser.compilationUnitOrScript() | ||
|
||
def format(formatter: ScalaFormatter, result: Result) = formatter.format(result)(FormatterState()) | ||
|
||
} |