Skip to content

Commit

Permalink
Tests for daniel-trinh#12
Browse files Browse the repository at this point in the history
  • Loading branch information
bambuchaAdm authored and Łukasz Dubiel committed Mar 25, 2015
1 parent 2311d0c commit bc3782a
Showing 1 changed file with 55 additions and 0 deletions.
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


}

0 comments on commit bc3782a

Please sign in to comment.