Skip to content

🏗️ build: compile for Scala 3.3 (LTS) #364

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

Merged
merged 1 commit into from
Nov 5, 2023
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH

### Changed

- [Build] Upgraded Scala 3 to 3.3.1 (LTS)

### Deprecated

### Removed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The table below shows the compatible versions:

| Cucumber Scala version | Cucumber Core version | Scala versions |
|------------------------|-----------------------|------------------------|
| 8.18+ | 7.x | 2.12, 2.13, 3.3+ |
| 8.13+ | 7.x | 2.12, 2.13, 3.2+ |
| 8.0-8.12 | 7.x | 2.12, 2.13, 3.0+ |
| 7.x | 6.x | 2.11, 2.12, 2.13, 3.0+ |
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ThisBuild / homepage := Some(

val scala212 = "2.12.16"
val scala213 = "2.13.12"
val scala3 = "3.2.1"
val scala3 = "3.3.1"

scalaVersion := scala213

Expand Down
53 changes: 19 additions & 34 deletions integration-tests/common/src/test/scala/cukes/StepDefs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@ import scala.jdk.CollectionConverters._
@nowarn
class CukesStepDefinitions extends ScalaDsl with EN {

var calorieCount = 0.0
var intBelly: Int = 0
var longBelly: Long = 0L
var stringBelly: String = ""
var doubleBelly: Double = 0.0
var floatBelly: Float = 0.0f
var shortBelly: Short = 0.toShort
var byteBelly: Byte = 0.toByte
var bigDecimalBelly: BigDecimal = BigDecimal(0)
var bigIntBelly: BigInt = BigInt(0)
var charBelly: Char = 'A'
var boolBelly: Boolean = false
var snake: Snake = null
var person: Person = null
var cukes: JList[Cukes] = null
var gin: Int = 13
var vermouth: Int = 42
var maritinis: Int = 0

Given("""I have {} {string} in my belly""") { (howMany: Int, what: String) =>
}

var calorieCount = 0.0

Given("""^I have the following foods :$""") { (table: DataTable) =>
val maps: JList[JMap[String, String]] =
table.asMaps(classOf[String], classOf[String])
Expand All @@ -30,71 +47,55 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(calories, calorieCount, 0.0)
}

var intBelly: Int = 0

Given("""I have eaten an int {int}""") { (arg0: Int) =>
intBelly = arg0
}
Then("""^I should have one hundred in my belly$""") { () =>
assertEquals(100, intBelly)
}

var longBelly: Long = 0L

Given("""I have eaten a long {long}""") { (arg0: Long) =>
longBelly = arg0
}
Then("""^I should have long one hundred in my belly$""") { () =>
assertEquals(100L, longBelly)
}

var stringBelly: String = ""

Given("""^I have eaten "(.*)"$""") { (arg0: String) =>
stringBelly = arg0
}
Then("""^I should have numnumnum in my belly$""") { () =>
assertEquals("numnumnum", stringBelly)
}

var doubleBelly: Double = 0.0

Given("""I have eaten {double} doubles""") { (arg0: Double) =>
doubleBelly = arg0
}
Then("""^I should have one and a half doubles in my belly$""") { () =>
assertEquals(1.5, doubleBelly, 0.0)
}

var floatBelly: Float = 0.0f

Given("""I have eaten {} floats""") { (arg0: Float) =>
floatBelly = arg0
}
Then("""^I should have one and a half floats in my belly$""") { () =>
assertEquals(1.5f, floatBelly, 0.0)
}

var shortBelly: Short = 0.toShort

Given("""I have eaten a short {short}""") { (arg0: Short) =>
shortBelly = arg0
}
Then("""^I should have short one hundred in my belly$""") { () =>
assertEquals(100.toShort, shortBelly)
}

var byteBelly: Byte = 0.toByte

Given("""I have eaten a byte {byte}""") { (arg0: Byte) =>
byteBelly = arg0
}
Then("""^I should have two byte in my belly$""") { () =>
assertEquals(2.toByte, byteBelly)
}

var bigDecimalBelly: BigDecimal = BigDecimal(0)

Given("""I have eaten {bigdecimal} big decimals""") {
(arg0: java.math.BigDecimal) =>
bigDecimalBelly = arg0
Expand All @@ -103,8 +104,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(BigDecimal(1.5), bigDecimalBelly)
}

var bigIntBelly: BigInt = BigInt(0)

Given("""I have eaten {biginteger} big int""") {
(arg0: java.math.BigInteger) =>
bigIntBelly = arg0.intValue()
Expand All @@ -113,17 +112,13 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(BigInt(10), bigIntBelly)
}

var charBelly: Char = 'A'

Given("""I have eaten char '{char}'""") { (arg0: Char) =>
charBelly = 'C'
}
Then("""^I should have character C in my belly$""") { () =>
assertEquals('C', charBelly)
}

var boolBelly: Boolean = false

Given("""I have eaten boolean {boolean}""") { (arg0: Boolean) =>
boolBelly = arg0
}
Expand All @@ -144,8 +139,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
)
}

var snake: Snake = null

Given("""I see in the distance ... {snake}""") { (s: Snake) =>
snake = s
}
Expand All @@ -155,8 +148,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(Symbol(dir), snake.direction)
}

var person: Person = null

Given("""I have a person {person}""") { (p: Person) =>
person = p
}
Expand All @@ -165,8 +156,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(person.hello, s)
}

var cukes: JList[Cukes] = null

Given("^I have eaten the following cukes$") { (cs: JList[Cukes]) =>
cukes = cs
}
Expand All @@ -179,10 +168,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
assertEquals(colors, cukes.asScala.map(_.color).mkString(", "))
}

var gin: Int = 13
var vermouth: Int = 42
var maritinis: Int = 0

Given("^I drink gin and vermouth$") { () =>
gin = 13
vermouth = 42
Expand Down
11 changes: 11 additions & 0 deletions project/ScalacOptions.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
object ScalacOptions {

val scalacOptions3 = Seq(
"-encoding",
"utf-8", // Specify character encoding used by source files.
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-explain", // Explain type errors in more detail.
// "-explaintypes", // Explain type errors in more detail.
Expand All @@ -10,6 +12,15 @@ object ScalacOptions {
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Wvalue-discard", // Warn when non-Unit expression results are unused.
"-Wunused:implicits", // Warn if an implicit parameter is unused.
"-Wunused:explicits",
"-Wunused:imports", // Warn if an import selector is not referenced.
"-Wunused:locals", // Warn if a local definition is unused.
"-Wunused:params", // Warn if a value parameter is unused.
"-Wunused:privates", // Warn if a private member is unused.
"-Ykind-projector",
"-Ysafe-init",
"-Xfatal-warnings" // Fail the compilation if there are any warnings.
)

Expand Down