Skip to content

Commit

Permalink
RedundantParens: enable infixSide in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 21, 2024
1 parent 81b429d commit 8437d83
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rewrite.rules = [RedundantParens]
rewrite.redundantParens.infixSide = some
<<< basic
object a {
def c(b: List[Int]): List[Int] =
Expand Down Expand Up @@ -553,6 +554,29 @@ object a {
)
}
>>>
Idempotency violated
=> Diff (- obtained, + expected)
case false => false
- + e
+ + e
val b = c + (d match
<<< #2194 6 match with parens, dot and no braces, !infixSide
runner.dialect = scala3
rewrite.redundantParens.infixSide = null
===
object a {
val b = c + (d.match
case true => true
case false => false)
val b = c + (d.match
case true => true
case false => false) + e
val b = c + (d match
case true => true
case false => false
)
}
>>>
object a {
val b = c + (d.match
case true => true
Expand Down Expand Up @@ -940,6 +964,22 @@ object a {
(new foo(bar).baz) * qux
}
>>>
object a {
foo * new bar
foo * new bar(baz).qux
new foo * bar
new foo(bar).baz * qux
}
<<< infix with new, !infixSide
rewrite.redundantParens.infixSide = null
===
object a {
foo * (new bar)
foo * (new bar(baz).qux)
(new foo) * bar
(new foo(bar).baz) * qux
}
>>>
object a {
foo * (new bar)
foo * (new bar(baz).qux)
Expand Down Expand Up @@ -987,6 +1027,8 @@ object a {
new foo(bar: baz)
}
<<< infix expressions with infixSide = null
rewrite.redundantParens.infixSide = null
===
object a {
// null+
foo & (0) // literal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
val explored = Debug.explored.get()
logger.debug(s"Total explored: $explored")
if (!onlyUnit && !onlyManual)
assertEquals(explored, 1084572, "total explored")
assertEquals(explored, 1084768, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit 8437d83

Please sign in to comment.