-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prepare build for scala 3 * resolve warnings for scala 3 * changed 2.13.8 to 2.13.11 * remove 2.11 and move scala-2 macro to scala-2 directory * fix crossScalaVersions and tests * tests prepared for scala 3 * mocks reimplemented with scala 3 * restricted vars support * java workaround * fix path dependent types in type constructors * add scala 3 to workflow; remove scala_2.11 * Update build.sbt Co-authored-by: Seth Tisue <[email protected]> * Update .github/workflows/scala.yml Co-authored-by: Seth Tisue <[email protected]> * add comment about scala 3.3.0 * review fixes * return java 11 in pipeline * review fixes --------- Co-authored-by: Seth Tisue <[email protected]>
- Loading branch information
1 parent
61e10c7
commit bb5d373
Showing
74 changed files
with
1,426 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
jvm/src/test/scala-2/com/paulbutcher/test/mock/ByNameParametersTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.paulbutcher.test.mock | ||
|
||
import com.paulbutcher.test.TestTrait | ||
import org.scalamock.function.FunctionAdapter1 | ||
import org.scalatest.matchers.should.Matchers | ||
import org.scalamock.scalatest.MockFactory | ||
import org.scalatest.freespec.AnyFreeSpec | ||
|
||
class ByNameParametersTest extends AnyFreeSpec with MockFactory with Matchers { | ||
|
||
autoVerify = false | ||
|
||
"cope with methods with by name parameters" in { | ||
withExpectations { | ||
val m = mock[TestTrait] | ||
(m.byNameParam _).expects(*).returning("it worked") | ||
assertResult("it worked") { m.byNameParam(42) } | ||
} | ||
} | ||
|
||
//! TODO - find a way to make this less ugly | ||
"match methods with by name parameters" in { | ||
withExpectations { | ||
val m = mock[TestTrait] | ||
val f: (=> Int) => Boolean = { x => x == 1 && x == 2 } | ||
((m.byNameParam _): (=> Int) => String).expects(new FunctionAdapter1(f)).returning("it works") | ||
var y = 0 | ||
assertResult("it works") { m.byNameParam { y += 1; y } } | ||
} | ||
} | ||
} |
Oops, something went wrong.