forked from scala-ide/scalariform
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Łukasz Dubiel
committed
Mar 19, 2015
1 parent
58dcb07
commit ebedc0f
Showing
3 changed files
with
63 additions
and
17 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
43 changes: 33 additions & 10 deletions
43
...est/scala/com/danieltrinh/scalariform/formatter/MultipleParameterListsFormatterTest.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 |
---|---|---|
@@ -1,38 +1,61 @@ | ||
package com.danieltrinh.scalariform.formatter | ||
|
||
import com.danieltrinh.scalariform.parser.{CompilationUnit, ScalaParser} | ||
import com.danieltrinh.scalariform.formatter.preferences.{BreakMultipleParameterGroups, FormattingPreferences} | ||
|
||
class MultipleParameterListsFormatterTest extends AbstractExpressionFormatterTest { | ||
|
||
override def debug = false | ||
|
||
"""def f(x: Int)(y: Int): Int = { | ||
{ | ||
|
||
implicit val formatting = FormattingPreferences.setPreference(BreakMultipleParameterGroups, true) | ||
|
||
"""def f(x: Int) | ||
|(y: Int): Int = { | ||
|} | ||
|""" ==> """def f(x: Int)(y: Int): Int = { | ||
|} | ||
|""" | ||
"""def f(x: Int) | ||
| (y: Int)(z: Int): Int = { | ||
|}""" ==>"""def f(x: Int)(y: Int)(z: Int): Int = { | ||
|} | ||
|""" | ||
|
||
} | ||
|
||
{ | ||
|
||
implicit val formatting = FormattingPreferences.setPreference(BreakMultipleParameterGroups, true) | ||
.setPreference(BreakMultipleParameterGroups.BreakingThreshold, 4) | ||
|
||
"""def f(x: Int)(y: Int): Int = { | ||
|} | ||
|""" ==> | ||
"""def f(x: Int) | ||
"""def f(x: Int) | ||
| (y: Int): Int = { | ||
|} | ||
|""" | ||
|
||
"""def f(x: Int) | ||
"""def f(x: Int) | ||
| (y: Int)(z: Int): Int = { | ||
|} | ||
""" ==> | ||
"""def f(x: Int) | ||
"""def f(x: Int) | ||
| (y: Int) | ||
| (z: Int): Int = { | ||
|} | ||
|""" | ||
|
||
// See issue #73 | ||
"""def mergeMapsCombiningValueMaps[A, B, C](collisionFunc: (C, C) => C)(m1: Map[A, Map[Seq[B], C]], m2: Map[A, Map[Seq[B], C]]): Map[A, Map[Seq[B], C]] = { | ||
|""" // See issue #73 | ||
"""def mergeMapsCombiningValueMaps[A, B, C](collisionFunc: (C, C) => C)(m1: Map[A, Map[Seq[B], C]], m2: Map[A, Map[Seq[B], C]]): Map[A, Map[Seq[B], C]] = { | ||
| mergeMaps(m1, m2)((m11, m22) => mergeMaps(m11, m22)(collisionFunc)) | ||
|}""" ==> | ||
"""def mergeMapsCombiningValueMaps[A, B, C](collisionFunc: (C, C) => C) | ||
"""def mergeMapsCombiningValueMaps[A, B, C](collisionFunc: (C, C) => C) | ||
| (m1: Map[A, Map[Seq[B], C]], m2: Map[A, Map[Seq[B], C]]): Map[A, Map[Seq[B], C]] = { | ||
| mergeMaps(m1, m2)((m11, m22) => mergeMaps(m11, m22)(collisionFunc)) | ||
|}""" | ||
|
||
} | ||
|
||
|
||
|
||
} |