Skip to content

Commit

Permalink
Test chained maps with multiline blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Nov 23, 2024
1 parent af0a598 commit 9fae106
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11249,3 +11249,45 @@ object a {

if (s.costWithPenalty <= 0) true else { preFork = false; false }
}
<<< chained maps with multi-line blocks, with braces-to-parens OK
rewrite.rules = [RedundantBraces]
===
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
<<< chained maps with multi-line blocks, with braces-to-parens not OK
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
42 changes: 42 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 @@ -10494,3 +10494,45 @@ object a {

if (s.costWithPenalty <= 0) true else { preFork = false; false }
}
<<< chained maps with multi-line blocks, with braces-to-parens OK
rewrite.rules = [RedundantBraces]
===
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
<<< chained maps with multi-line blocks, with braces-to-parens not OK
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
42 changes: 42 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 @@ -11001,3 +11001,45 @@ object a {

if (s.costWithPenalty <= 0) true else { preFork = false; false }
}
<<< chained maps with multi-line blocks, with braces-to-parens OK
rewrite.rules = [RedundantBraces]
===
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
<<< chained maps with multi-line blocks, with braces-to-parens not OK
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11429,3 +11429,45 @@ object a {
false
}
}
<<< chained maps with multi-line blocks, with braces-to-parens OK
rewrite.rules = [RedundantBraces]
===
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
<<< chained maps with multi-line blocks, with braces-to-parens not OK
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
>>>
object a {
def foo = bar {
// c1
baz
}.qux { x =>
// c2
quux(x)
}
}
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, 1089000, "total explored")
assertEquals(explored, 1089468, "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 9fae106

Please sign in to comment.