Skip to content

Commit

Permalink
Tests: add extra without dangling, remove obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed May 10, 2024
1 parent 67c0381 commit e0e7f1c
Show file tree
Hide file tree
Showing 13 changed files with 528 additions and 19 deletions.
153 changes: 153 additions & 0 deletions scalafmt-tests/src/test/resources/binPack/LiteralList.stat
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,159 @@ private[this] lazy val charTypesFirst256 = Array[scala.Byte](15, 15, 15, 15,
-1,
-1 )
>>>
private val lengthByLeading: Array[Int] = Array(
// 10wwwwww
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1,
// 110yyyyy
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2,
// 1110zzzz
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
// 11110uuu
4, 4, 4, 4, 4, 4, 4, 4,
// > 11110111
-1, -1, -1, -1, -1, -1, -1, -1)
<<< native 2, !dangle
danglingParentheses.preset = false
===
private val lengthByLeading: Array[Int] = Array(
// 10wwwwww
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
// 110yyyyy
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
// 1110zzzz
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
// 11110uuu
4,
4,
4,
4,
4,
4,
4,
4,
// > 11110111
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1 )
>>>
private val lengthByLeading: Array[Int] = Array(
// 10wwwwww
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Expand Down
15 changes: 15 additions & 0 deletions scalafmt-tests/src/test/resources/binPack/ParentConstructors.stat
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ object a {
case class TopLevelExportInfo(moduleID: String, jsName: String)(
val pos: Position) extends ExportInfo
}
<<< #2633 keep with class, !dangle
maxColumn = 70
binPack.preset = true
binPack.parentConstructors = keep
danglingParentheses.preset = false
===
object a {
case class TopLevelExportInfo(moduleID: String, jsName: String)(
val pos: Position) extends ExportInfo
}
>>>
object a {
case class TopLevelExportInfo(moduleID: String, jsName: String)(
val pos: Position) extends ExportInfo
}
<<< #2977 binpack always
binPack.parentConstructors = always
===
Expand Down
8 changes: 0 additions & 8 deletions scalafmt-tests/src/test/resources/binPack/TermNameList

This file was deleted.

63 changes: 62 additions & 1 deletion scalafmt-tests/src/test/resources/binPack/TermNameList.stat
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ val secret: List[Bit] = List(
aaaaa,
bbbbbbb
)
<<< unsafeCallSite forced newline
<<< unsafeCallSite forced newline, cfg + dangle
maxColumn = 20
binPack.unsafeCallSite = true
danglingParentheses.callSite = true
newlines.configStyleCallSite.prefer = true
===
somethingVeryLong(bar{baz(
qux // c1
Expand All @@ -70,6 +72,57 @@ somethingVeryLong(
qux // c1
)
})
<<< unsafeCallSite forced newline, cfg + !dangle
maxColumn = 20
binPack.unsafeCallSite = true
danglingParentheses.callSite = false
newlines.configStyleCallSite.prefer = true
===
somethingVeryLong(bar{baz(
qux // c1
)}
)
>>>
somethingVeryLong(
bar {
baz(
qux // c1
)
})
<<< unsafeCallSite forced newline, !cfg + dangle
maxColumn = 20
binPack.unsafeCallSite = true
danglingParentheses.callSite = true
newlines.configStyleCallSite.prefer = false
===
somethingVeryLong(bar{baz(
qux // c1
)}
)
>>>
somethingVeryLong(
bar {
baz(
qux // c1
)
}
)
<<< unsafeCallSite forced newline, !cfg + !dangle
maxColumn = 20
binPack.unsafeCallSite = true
danglingParentheses.callSite = false
newlines.configStyleCallSite.prefer = false
===
somethingVeryLong(bar{baz(
qux // c1
)}
)
>>>
somethingVeryLong(
bar {
baz(qux // c1
)
})
<<< unsafeCallSite no split
binPack.unsafeCallSite = true
===
Expand All @@ -88,6 +141,14 @@ binPack.literalsSingleLine = true
===
val secret: List[Bit] = List(select, aaaaa, bbbbbbb, bbbbbbb, bbbbbbb, aaaaa, aaaaa, bbbbbbb, aaaaa, aaaaa, aaaaa, bbbbbbb, aaaaa)
>>>
val secret: List[Bit] = List(
select, aaaaa, bbbbbbb, bbbbbbb, bbbbbbb, aaaaa, aaaaa, bbbbbbb, aaaaa, aaaaa, aaaaa, bbbbbbb, aaaaa)
<<< literalsSingleLine=true !dangle
binPack.literalsSingleLine = true
danglingParentheses.preset = false
===
val secret: List[Bit] = List(select, aaaaa, bbbbbbb, bbbbbbb, bbbbbbb, aaaaa, aaaaa, bbbbbbb, aaaaa, aaaaa, aaaaa, bbbbbbb, aaaaa)
>>>
val secret: List[Bit] = List(
select, aaaaa, bbbbbbb, bbbbbbb, bbbbbbb, aaaaa, aaaaa, bbbbbbb, aaaaa, aaaaa, aaaaa, bbbbbbb, aaaaa)
<<< literalsSingleLine=true, accept no split
Expand Down
66 changes: 66 additions & 0 deletions scalafmt-tests/src/test/resources/newlines/source_classic.stat
Original file line number Diff line number Diff line change
Expand Up @@ -3016,6 +3016,14 @@ danglingParentheses.callSite = true
object a {
foo(
bar.baz(Seq(
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")),
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")
),
Qux(
"", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")),
Qux(
"", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")
Expand All @@ -3028,6 +3036,12 @@ object a {
foo(
bar.baz(
Seq(
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")),
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")),
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar")),
Qux("", 1, "par1", "2018-01-01", "2018-12-31", "2018-01-01", "2018-02-01", None, None, 1000,
Some(0), Some(1), foo = Some("bar"))
)
Expand All @@ -3047,6 +3061,11 @@ object a {
private val audience3 = apiAudience(
3, "b_name", Sams, Inid, "2", "created-by-user2", "updated-by-user2"
).copy(
updatedAt = nowDate.minusDays(15),
audienceSizeOnsite = Some(3333),
audienceSizeOffsite = Some(1))
private val audience3 = apiAudience(
3, "b_name", Sams, Inid, "2", "created-by-user2", "updated-by-user2").copy(
updatedAt = nowDate.minusDays(15),
audienceSizeOnsite = Some(3333),
audienceSizeOffsite = Some(1)
Expand All @@ -3060,6 +3079,12 @@ object a {
audienceSizeOnsite = Some(3333),
audienceSizeOffsite = Some(1)
)
private val audience3 =
apiAudience(3, "b_name", Sams, Inid, "2", "created-by-user2", "updated-by-user2").copy(
updatedAt = nowDate.minusDays(15),
audienceSizeOnsite = Some(3333),
audienceSizeOffsite = Some(1)
)
}
<<< binPack indent expiresOn=Before when dangle, configStyleArguments
binPack.preset = true
Expand Down Expand Up @@ -5021,6 +5046,28 @@ object a {
qux
}
}
<<< binPack.xxxSite = Oneline, !sometimesBeforeColonInMethodReturnType, !dangle
maxColumn = 50
binPack.callSite = Oneline
binPack.defnSite = Oneline
danglingParentheses.preset = false
newlines.sometimesBeforeColonInMethodReturnType = false
===
object a {
def foo(bb: BB, cc: CC,
dd: DD = DDD.ddd): Bar[Baz] = {
// c
qux
}
}
>>>
object a {
def foo(bb: BB, cc: CC, dd: DD = DDD.ddd): Bar[
Baz] = {
// c
qux
}
}
<<< binPack.defnSite = Oneline, one arg
binPack.defnSite = Oneline
newlines.sometimesBeforeColonInMethodReturnType = false
Expand All @@ -5039,6 +5086,25 @@ object a {
qux
}
}
<<< binPack.defnSite = Oneline, one arg, !dangle
binPack.defnSite = Oneline
danglingParentheses.preset = false
newlines.sometimesBeforeColonInMethodReturnType = false
===
object a {
def foo(dd: DD[AA[BB], CC] = DDD.ddd): Bar[Baz] = {
// c
qux
}
}
>>>
object a {
def foo(dd: DD[AA[BB], CC] =
DDD.ddd): Bar[Baz] = {
// c
qux
}
}
<<< binPack.defnSite = Oneline, one arg, also bracketCallSite
binPack.bracketCallSite = Oneline
binPack.defnSite = Oneline
Expand Down
Loading

0 comments on commit e0e7f1c

Please sign in to comment.