Skip to content

Update to Scala 3.3.0 #2

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

Closed
wants to merge 1 commit into from
Closed
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: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / scalaVersion := "3.2.2"
ThisBuild / scalaVersion := "3.3.0"
ThisBuild / organization := "eu.monniot"
ThisBuild / homepage := Some(url("https://github.com/fmonniot/scala3mock"))
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/scala/eu/monniot/scala3mock/mock/MockSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class MockSuite extends munit.FunSuite with MockFunctions {
assertEquals(m.curriedFuncReturn(2), doubleToString)

// Polymorphic methods
when(m.polymorphic _).expects(List(2)).returns("a1")
// Fail to compile with 3.3.0
when[List[Int], String](m.polymorphic).expects(List(2)).returns("a1")
assertEquals(m.polymorphic(List(2)), "a1")

val javaObject = Object()
Expand All @@ -71,11 +72,10 @@ class MockSuite extends munit.FunSuite with MockFunctions {
when(m.polycurried(_: String)(_: Int)).expects("a", 2).returns("c" -> 6)
assertEquals(m.polycurried("a")(2), "c" -> 6)

when(m.polymorphicParam).expects((1, 2.0)).returns("ok")
// Fail to compile with 3.3.0
when[(Int, Double), String](m.polymorphicParam).expects((1, 2.0)).returns("ok")
assertEquals(m.polymorphicParam((1, 2.0)), "ok")

when(m.repeatedParam _).expects(0, Seq.empty).returning("hello")
assertEquals(m.repeatedParam(0), "hello")

// TODO Not supported yet
// when(m.byNameParam).expects(3).returns("ok")
Expand All @@ -89,12 +89,12 @@ class MockSuite extends munit.FunSuite with MockFunctions {
assertEquals(m.implicitParam(42), "it works")

// type bound methods
when(m.upperBound _).expects(TestException()).returns(1)
when[TestException, Int](m.upperBound _).expects(TestException()).returns(1)
assertEquals(m.upperBound(TestException()), 1)

val animal = Animal()
val dog = Dog()
when(m.lowerBound).expects(animal, List(dog)).returns("ok")
when[Animal, List[Animal], String](m.lowerBound).expects(animal, List(dog)).returns("ok")
assertEquals(m.lowerBound(animal, List(dog)), "ok")

// TODO with implementation methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ErrorReportingTest

test("execute block of code") {
val mockedTrait = mock[TestTrait]
when(mockedTrait.polymorphicMethod).expects(List(1)).returning("one")
when[List[Int], String](mockedTrait.polymorphicMethod).expects(List(1)).returning("one")

suiteScopeMock.noParamMethod()
mockedTrait.oneParamMethod(3)
Expand Down