Skip to content

Commit

Permalink
Test AvoidInfix w/ fold, redundant braces, else
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 22, 2024
1 parent 4e207e2 commit 0186bc9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions scalafmt-tests/shared/src/test/resources/rewrite/AvoidInfix.stat
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,17 @@ object a {
try (new compiler.Run).compile(sourceFiles.map(_.toString))
catch { case ex: Throwable => }
}
<<< #4133 avoid infix, with arg in rewritten braces just before `else`
maxColumn = 76
newlines.source = fold
newlines.avoidForSimpleOverflow = [tooLong, punct, slc]
rewrite.rules = [RedundantBraces, RedundantParens, AvoidInfix]
===
def primaryConstructor: Option[MemberImpl with Constructor] = if (isClass) constructors find { _.isPrimary } else None
>>>
Idempotency violated
=> Diff (- obtained, + expected)
def primaryConstructor: Option[MemberImpl with Constructor] =
- if (isClass) constructors.find(_.isPrimary) else None
+ if (isClass) constructors.find(_.isPrimary)
+ else None
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,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, 1483242, "total explored")
assertEquals(explored, 1483317, "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 0186bc9

Please sign in to comment.