Skip to content

Commit

Permalink
Add tests with comment in a select chain
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Dec 23, 2021
1 parent ec3f3c9 commit a90d480
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scalafmt-tests/src/test/resources/newlines/source_classic.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5452,3 +5452,31 @@ object a {
} a +
b
}
<<< comment in select chain
optIn.breaksInsideChains = true
optIn.breakChainOnFirstMethodDot = false
===
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
>>>
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo
.bar(baz) // c1
// c2
.foo(bar, baz)
}
24 changes: 24 additions & 0 deletions scalafmt-tests/src/test/resources/newlines/source_fold.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5226,3 +5226,27 @@ private implicit class ApiExceptionToErrorResponseConverter(ex: ApiException) {
def toErrors: Seq[ErrorResponse] =
Seq(ErrorResponse(ex.errorType.code, ex.errorType.name, Option(ex.getMessage)))
}
<<< comment in select chain
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
>>>
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
24 changes: 24 additions & 0 deletions scalafmt-tests/src/test/resources/newlines/source_keep.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5476,3 +5476,27 @@ object a {
} a +
b
}
<<< comment in select chain
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
>>>
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
25 changes: 25 additions & 0 deletions scalafmt-tests/src/test/resources/newlines/source_unfold.stat
Original file line number Diff line number Diff line change
Expand Up @@ -5703,3 +5703,28 @@ object a {
b
}
}
<<< comment in select chain
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo.bar(baz) // c1
// c2
.foo(bar, baz)
}
>>>
object a {
foo
// c2
.bar(baz).foo(bar, baz)
foo // c1
// c2
.bar(baz).foo(bar, baz)
foo
.bar(baz) // c1
// c2
.foo(bar, baz)
}

0 comments on commit a90d480

Please sign in to comment.