Skip to content

Commit

Permalink
Test select with apply in braces and single func
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 27, 2024
1 parent 7b35b4f commit 8c6e447
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11291,3 +11291,37 @@ object a {
quux(x)
}
}
<<< #4133 select with braced apply and single function arg, !parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = false
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy {
x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
<<< #4133 select with braced apply and single function arg, parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = true
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy {
x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
33 changes: 33 additions & 0 deletions scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat
Original file line number Diff line number Diff line change
Expand Up @@ -10532,3 +10532,36 @@ object a {
quux(x)
}
}
<<< #4133 select with braced apply and single function arg, !parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = false
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy {
x => (x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
<<< #4133 select with braced apply and single function arg, parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = true
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest)
.sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
34 changes: 34 additions & 0 deletions scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat
Original file line number Diff line number Diff line change
Expand Up @@ -11043,3 +11043,37 @@ object a {
quux(x)
}
}
<<< #4133 select with braced apply and single function arg, !parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = false
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy {
x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
<<< #4133 select with braced apply and single function arg, parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = true
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy {
x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
Original file line number Diff line number Diff line change
Expand Up @@ -11471,3 +11471,39 @@ object a {
quux(x)
}
}
<<< #4133 select with braced apply and single function arg, !parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = false
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines
.filter(x => x.minNest <= x.maxNest)
.sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
<<< #4133 select with braced apply and single function arg, parensForOneLineApply
maxColumn = 74
newlines {
avoidForSimpleOverflow = [punct, slc, tooLong]
ignoreInSyntax = false
}
rewrite.rules = [RedundantBraces]
rewrite.redundantBraces.parensForOneLineApply = true
===
topLevelStatementBlankLines.filter(x => x.minNest <= x.maxNest).sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
>>>
topLevelStatementBlankLines
.filter(x => x.minNest <= x.maxNest)
.sortBy { x =>
(x.minBreaks, x.maxNest, -x.minNest, x.regex.fold(0)(-_.length))
}
Original file line number Diff line number Diff line change
Expand Up @@ -7840,3 +7840,42 @@ object a:
>>>
object a:
def func(f: ->{a, b, c} B): Unit
<<< #4133 select with braced apply and single function arg, within interpolation
maxColumn = 70
rewrite.rules = [RedundantBraces]
===
s"`$name0${index.toString.toCharArray.nn.map {x => (x - '0' + '₀').toChar}.mkString}`"
>>>
s"`$name0${index.toString.toCharArray.nn.map { x =>
(x - '0' + '₀').toChar
}.mkString}`"
<<< #4133 select with braced apply, single function arg in second clause
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
>>>
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
<<< #4133 select with braced apply, single function arg, within another apply
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
>>>
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -7539,3 +7539,37 @@ object a:
>>>
object a:
def func(f: ->{a, b, c} B): Unit
<<< #4133 select with braced apply and single function arg, within interpolation
maxColumn = 70
rewrite.rules = [RedundantBraces]
===
s"`$name0${index.toString.toCharArray.nn.map {x => (x - '0' + '₀').toChar}.mkString}`"
>>>
s"`$name0${index.toString.toCharArray.nn
.map(x => (x - '0' + '₀').toChar).mkString}`"
<<< #4133 select with braced apply, single function arg in second clause
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
>>>
next.fold(resultsDiv.appendChild(m.toHTML)) { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
<<< #4133 select with braced apply, single function arg, within another apply
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
>>>
lazy val onlyImplicitOrTypeParams = paramss.forall(_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
})
Original file line number Diff line number Diff line change
Expand Up @@ -7864,3 +7864,42 @@ object a:
>>>
object a:
def func(f: ->{a, b, c} B): Unit
<<< #4133 select with braced apply and single function arg, within interpolation
maxColumn = 70
rewrite.rules = [RedundantBraces]
===
s"`$name0${index.toString.toCharArray.nn.map {x => (x - '0' + '₀').toChar}.mkString}`"
>>>
s"`$name0${index.toString.toCharArray.nn.map { x =>
(x - '0' + '₀').toChar
}.mkString}`"
<<< #4133 select with braced apply, single function arg in second clause
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
>>>
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
<<< #4133 select with braced apply, single function arg, within another apply
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
>>>
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -8158,3 +8158,47 @@ object a:
>>>
object a:
def func(f: ->{a, b, c} B): Unit
<<< #4133 select with braced apply and single function arg, within interpolation
maxColumn = 70
rewrite.rules = [RedundantBraces]
===
s"`$name0${index.toString.toCharArray.nn.map {x => (x - '0' + '₀').toChar}.mkString}`"
>>>
s"`$name0${index
.toString
.toCharArray
.nn
.map { x =>
(x - '0' + '₀').toChar
}
.mkString}`"
<<< #4133 select with braced apply, single function arg in second clause
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
>>>
next.fold {
resultsDiv.appendChild(m.toHTML)
} { next =>
resultsDiv.insertBefore(m.toHTML, next)
}
<<< #4133 select with braced apply, single function arg, within another apply
maxColumn = 66
rewrite.rules = [RedundantBraces]
===
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
>>>
lazy val onlyImplicitOrTypeParams = paramss.forall(
_.exists { sym =>
sym.isType || sym.is(Implicit) || sym.is(Given)
}
)
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, 1183640, "total explored")
assertEquals(explored, 1186090, "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 8c6e447

Please sign in to comment.