Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.8.1 #1228

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ bf41266be61fb4d1fcbe1b46d67fabf33eecb4c9

# Scala Steward: Reformat with scalafmt 3.7.13
56b37d252542a462130b12a735aecf857648cb3e

# Scala Steward: Reformat with scalafmt 3.8.1
6b66c9afc6044f304b757b9f68a58786e8e4fce9
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.0"
version = "3.8.1"
runner.dialect = scala3

maxColumn = 120
Expand Down
5 changes: 2 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,8 @@ lazy val releaseSettings: Seq[Setting[_]] = Seq(
),
ThisBuild / git.useGitDescribe := true,
ThisBuild / dynverTagPrefix := SPECS2,
ThisBuild / git.gitTagToVersionNumber := {
tag: String =>
if (tag matches SPECS2 + ".*") Some(tag.replace(SPECS2, "")) else None
ThisBuild / git.gitTagToVersionNumber := { tag: String =>
if (tag matches SPECS2 + ".*") Some(tag.replace(SPECS2, "")) else None
},
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(
fp.js,
Expand Down
31 changes: 18 additions & 13 deletions core/shared/src/test/scala/org/specs2/control/DebugSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ class DebugSpec extends Specification {
def is = s2"""

It is possible to insert some method calls to print values on the console
pp prints a value and returns it ${val output = new output {}; import output.{given, *}
(Value(1).pp) `prints` "Value(1)"
pp prints a value and returns it ${
val output = new output {}; import output.{given, *}
(Value(1).pp) `prints` "Value(1)"
}
pp(condition) prints a value but only if a condition is true" ${val output = new output {}; import output.{given, *}
Value(1).pp(condition = false) `prints` nothing
Value(1).pp(condition = true) `prints` "Value(1)"
pp(condition) prints a value but only if a condition is true" ${
val output = new output {}; import output.{given, *}
Value(1).pp(condition = false) `prints` nothing
Value(1).pp(condition = true) `prints` "Value(1)"
}
pp(condition function) prints a value but only if a condition on that value is true" ${val output = new output {};
import output.{given, *}
Value(1).pp((v: Value) => v.i == 2) `prints` nothing
Value(1).pp((v: Value) => v.i == 1) `prints` "Value(1)"
pp(condition function) prints a value but only if a condition on that value is true" ${
val output = new output {};
import output.{given, *}
Value(1).pp((v: Value) => v.i == 2) `prints` nothing
Value(1).pp((v: Value) => v.i == 1) `prints` "Value(1)"
}
pp(show) prints a value with a specific show function ${val output = new output {}; import output.{given, *}
Value(1).pp((v: Value) => "v = " + v.i) `prints` "v = 1"
pp(show) prints a value with a specific show function ${
val output = new output {}; import output.{given, *}
Value(1).pp((v: Value) => "v = " + v.i) `prints` "v = 1"
}
pp(pre) prints a value with a prepended message ${val output = new output {}; import output.{given, *}
Value(1).pp("the value is") `prints` "the value is Value(1)"
pp(pre) prints a value with a prepended message ${
val output = new output {}; import output.{given, *}
Value(1).pp("the value is") `prints` "the value is Value(1)"
}}

"""
Expand Down
42 changes: 23 additions & 19 deletions core/shared/src/test/scala/org/specs2/control/FunctionsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,39 @@ import matcher.ExpectationsDescription.*
class FunctionsSpec extends Spec {
def is = s2"""

a byname function can be transformed into a strict one ${def byNameFunction(u: =>Unit): Unit = {}
var parameter = "not evaluated"
toStrictFunction1(byNameFunction) { parameter = "evaluated" }
a byname function can be transformed into a strict one ${
def byNameFunction(u: =>Unit): Unit = {}
var parameter = "not evaluated"
toStrictFunction1(byNameFunction) { parameter = "evaluated" }

"The byname function has become a strict one" <==> (parameter must ===("evaluated"))
"The byname function has become a strict one" <==> (parameter must ===("evaluated"))
}

functions can be or-ed with || ${val f1: String => Boolean = (_: String).length < 3
val f2: String => Boolean = (_: String).length < 5
functions can be or-ed with || ${
val f1: String => Boolean = (_: String).length < 3
val f2: String => Boolean = (_: String).length < 5

(f1 || f2)("abcdefg") must beFalse
(f1 || f2)("abc") must beTrue
(f1 || f2)("abcd") must beTrue
(f2 || f1)("ab") must beTrue
(f1 || f2)("abcdefg") must beFalse
(f1 || f2)("abc") must beTrue
(f1 || f2)("abcd") must beTrue
(f2 || f1)("ab") must beTrue
}

functions can be and-ed with &&" ${val f1: String => Boolean = (_: String).length < 3
val f2: String => Boolean = (_: String).length < 5
functions can be and-ed with &&" ${
val f1: String => Boolean = (_: String).length < 3
val f2: String => Boolean = (_: String).length < 5

(f1 && f2)("abcdefg") must beFalse
(f1 && f2)("abc") must beFalse
(f1 && f2)("abcd") must beFalse
(f2 && f1)("ab") must beTrue
(f1 && f2)("abcdefg") must beFalse
(f1 && f2)("abc") must beFalse
(f1 && f2)("abcd") must beFalse
(f2 && f1)("ab") must beTrue
}

functions can be negated with !" ${val f1: String => Boolean = (_: String).length < 3
functions can be negated with !" ${
val f1: String => Boolean = (_: String).length < 3

(!f1)("abcdefg") must beTrue
(!f1)("ab") must beFalse
(!f1)("abcdefg") must beTrue
(!f1)("ab") must beFalse
}

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ class ResultLogicalCombinatorsSpec extends Spec with ResultMatchers with TypedEq

A result can be evaluated only when a condition is true
${failure.when(false) must beSuccessful}
${var r = success; { r = failure1; r }.when(false); r must beSuccessful
}
${var r = success; { r = failure1; r }.when(false); r must beSuccessful}

A result can be evaluated only when a condition is false
${failure.unless(true) must beSuccessful}
${var r = success; { r = failure1; r }.unless(true); r must beSuccessful
}
${var r = success; { r = failure1; r }.unless(true); r must beSuccessful}

"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ class BeEqualToMatcherSpec extends Spec with ResultMatchers with ShouldMatchers
${(1 must ===(2)) must beLike { case Failure(_, _, _, FailureDetails(a, e)) => e must ===("2") }}

the actual value must be evaluated before the expected one
${var result = "";
{ { result = result + "a" }; 1 } must ===({ { result = result + "b" }; 1 })
result must ===("ab")
${
var result = "";
{ { result = result + "a" }; 1 } must ===({ { result = result + "b" }; 1 })
result must ===("ab")
}

Robustness
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class EitherMatchersSpec extends Spec with EitherMatchers with ResultMatchers {
${Left(1) must beLeft.like { case i => i must be_>(0) }}

beRight / beLeft must typecheck when composed with other matchers
${val boomException: Throwable = new Exception("boom")
Some(Left(boomException)) must beSome(beLeft(boomException))
${
val boomException: Throwable = new Exception("boom")
Some(Left(boomException)) must beSome(beLeft(boomException))
}

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ class DiffablePlusSpec extends Spec {
===
"""|Foo(x: 'a' != 'b'
| y: 1 != 2)""".stripMargin}
additional test case ${val actual = Book("Programming in Scala", Seq("Odersky", "me", "Venners"), 2008)
val expected = Book("Programming in Scala", Seq("Odersky", "Spoon", "Venners"), 2009)
Diffable.diff(actual, expected).render.removeColors.showSpaces ===
"""|Book(title: 'Programming in Scala'
| authors:
| Odersky
| - me
| + Spoon
| Venners
| pubYear: 2008 != 2009)""".stripMargin.showSpaces

additional test case ${
val actual = Book("Programming in Scala", Seq("Odersky", "me", "Venners"), 2008)
val expected = Book("Programming in Scala", Seq("Odersky", "Spoon", "Venners"), 2009)
Diffable.diff(actual, expected).render.removeColors.showSpaces ===
"""|Book(title: 'Programming in Scala'
| authors:
| Odersky
| - me
| + Spoon
| Venners
| pubYear: 2008 != 2009)""".stripMargin.showSpaces
}


Expand Down