Skip to content

Commit

Permalink
Add failing "unable to format due to bug" tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Feb 21, 2020
1 parent 09c589e commit e02df91
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scalafmt-tests/src/test/resources/default/Lambda.stat
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,40 @@ testAsync("Resource.make is equivalent to a partially applied bracket") { implic
}
}
}
<<< #448
object Foo {
code.collect {
case d: Defn.Def if (d match {
case _ => false


}) &&
d=>
}
}
>>>
Unable to format file due to bug in scalafmt
<<< #1485
style = IntelliJ
maxColumn = 120
===
class A {
def foo: B =
a.b() { c =>
val d = c.add(
D[E](
1, {
case conditionNameShouldLongEnough =>
foo1(objectNameShouldLongEnough, objectNameShouldLongEnough)
0
case conditionNameShouldLongEnough =>
foo1(objectNameShouldLongEnough, objectNameShouldLongEnough)
1
}
)
)
}
.f("f")
}
>>>
Unable to format file due to bug in scalafmt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,23 @@ def f = {
def f = {
something.call { x => g(x) }
}
<<< #1717
maxColumn = 100
===
class Bar {
def foo(request: Request): RpcResult[Response] = {
repository
.flatMap { campaigns =>
request match {
case Nil => connection.pure(Right(toResponse(campaigns, Map.empty)))
case _ =>
getProfileEmails(request.securityContext, profileIds).to[ConnectionIO].map {
profileEmails =>
Right(toResponse(campaigns, profileEmails))
}
}
}.transact(managerTransactor)
}
}
>>>
Unable to format file due to bug in scalafmt
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,42 @@ object a {
_ => e
)
}
<<< #1599 1: original, with partial func
object A {
def foo() = {
x.map(_.y(
abcd,
{ case ((abcdefghij, aswbasdfaw), asfda) => aswdf},
{ case (abcdefghij, sadfasdass) => (asdfa.sadvfs(abcdefghij).get, asdfasdfasfdasda.asdfas(asdfasdaas).get) },
foo
))
}
}
>>>
Unable to format file due to bug in scalafmt
<<< #1599 2: modified, with partial func inside block
object A {
def foo() = {
x.map(_.y(
abcd,
{{ case ((abcdefghij, aswbasdfaw), asfda) => aswdf}},
{{ case (abcdefghij, sadfasdass) => (asdfa.sadvfs(abcdefghij).get, asdfasdfasfdasda.asdfas(asdfasdaas).get) }},
foo
))
}
}
>>>
Unable to format file due to bug in scalafmt
<<< #1599 3: modified, with lambda
object A {
def foo() = {
x.map(_.y(
abcd,
{ case_abcdefghij_aswbasdfaw_asfda => aswdf},
{ case_abcdefghij_sadfasdass => (asdfa.sadvfs(abcdefghij).get, asdfasdfasfdasda.asdfas(asdfasdaas).get) },
foo
))
}
}
>>>
Unable to format file due to bug in scalafmt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@ def format_![T <: Tree](
)(implicit ev: Parse[T],
ev2: EC
): String
<<< #1462
maxColumn = 91
===
object Test {

def create(
somethingInfo: foo.T = Something("my-something", Some("test-something"), "something", Some(Format("something", "something")),
Some(something.Something("something", "something", "something", "something")))
): Unit = {
w(foo)
}

}
>>>
Unable to format file due to bug in scalafmt

0 comments on commit e02df91

Please sign in to comment.