-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
scalatest/shared/src/main/scala/test/golden/GoldenConfig.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,9 @@ | ||
package test.golden.scalatest | ||
|
||
// this is probably core! | ||
case class GoldenConfig( | ||
accept: Boolean | ||
) | ||
object GoldenConfig { | ||
val default = GoldenConfig(accept = false) | ||
} |
8 changes: 0 additions & 8 deletions
8
scalatest/shared/src/main/scala/test/golden/GoldenSuite.scala
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
scalatest/shared/src/main/scala/test/golden/HasGoldenConfig.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,20 @@ | ||
/* | ||
* Copyright 2024 Golden Scala Contributors <https://github.com/j-mie6/golden-scala/graphs/contributors> | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
package test.golden.scalatest | ||
|
||
import org.scalatest.{Args, Status, Suite} | ||
|
||
trait HasGoldenConfig extends Suite { | ||
private [golden] var goldenConfig: GoldenConfig = GoldenConfig.default | ||
|
||
abstract override def run(testName: Option[String], args: Args): Status = { | ||
val goldenAccept = args.configMap.getOptional[String]("golden.accept") | ||
.flatMap(_.toBooleanOption) | ||
.getOrElse(false) | ||
goldenConfig = goldenConfig.copy(accept = goldenAccept) | ||
super.run(testName, args) | ||
} | ||
} |