forked from scala-ide/scalariform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d848e9f
commit ddaa627
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
scalariform/src/test/scala/scalariform/formatter/AnnoatationFormatterTest.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,55 @@ | ||
package scalariform.formatter | ||
|
||
import scalariform.parser.{CompilationUnit, ScalaParser} | ||
|
||
/** | ||
* Created by bambucha on 02.03.14. | ||
*/ | ||
class AnnoatationFormatterTest extends AbstractFormatterTest { | ||
|
||
override def debug: Boolean = false | ||
|
||
def parse(parser: ScalaParser) = parser.compilationUnitOrScript() | ||
|
||
type Result = CompilationUnit | ||
|
||
def format(formatter: ScalaFormatter, result: Result) = formatter.format(result)(FormatterState(indentLevel = 0)) | ||
|
||
"def asdf(@annotation one: Int, @a @b(c) two: String)" ==> "def asdf(@annotation one: Int, @a @b(c) two: String)" | ||
|
||
|
||
"""class X { | ||
| def asdf( | ||
| @annotation one: Int, | ||
| @a @b(c) two: String | ||
| ) = ??? | ||
|} | ||
""".stripMargin ==> | ||
""" | ||
|class X { | ||
| def asdf( | ||
| @annotation | ||
| one: Int, | ||
| @a @b(c) | ||
| two: String | ||
| ) | ||
|} | ||
""".stripMargin | ||
|
||
"""class A extends B { | ||
| @SomeImportantAnnotation(param = true) override val param: Int = 1 | ||
| | ||
| @NotSoImportantAnnotation(param = false) val description: String = "Not so important" | ||
|} | ||
""".stripMargin ==> | ||
"""class A extends B { | ||
| @SomeImportantAnnotation(param = true) | ||
| override val param: Int = 1 | ||
| | ||
| @NotSoImportantAnnotation(param = false) | ||
| val description: String = "Not so important" | ||
|} | ||
""".stripMargin | ||
|
||
|
||
} |