Skip to content

Commit

Permalink
Moving flag from constructor to member
Browse files Browse the repository at this point in the history
  • Loading branch information
Baccata committed Sep 26, 2020
1 parent 435635a commit 73f89d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jvm/src/test/scala/org/expecty/ExpectyLocationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import junit.framework.ComparisonFailure
import com.eed3si9n.expecty.Expecty

class ExpectyLocationSpec {
val assert = new Expecty(true) // (displayLoc = true)
val assert = new Expecty { override val showLocation = true }

@Test
def position(): Unit = {
Expand Down
5 changes: 3 additions & 2 deletions shared/src/main/scala/com/eed3si9n/expecty/Expecty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

package com.eed3si9n.expecty

class Expecty(displayLoc: Boolean = false) extends Recorder[Boolean, Unit] {
class Expecty extends Recorder[Boolean, Unit] {
val failEarly: Boolean = true
val showTypes: Boolean = false
val showLocation: Boolean = false
// val printAsts: Boolean = false
// val printExprs: Boolean = false

Expand All @@ -28,7 +29,7 @@ class Expecty(displayLoc: Boolean = false) extends Recorder[Boolean, Unit] {
// if (printExprs) println(rendering)
if (!recordedExpr.value && failEarly) {
val loc = recordedExpr.location
val locStr = if(displayLoc) " (" + loc.relativePath + ":" + loc.line + ")" else ""
val locStr = if(showLocation) " (" + loc.relativePath + ":" + loc.line + ")" else ""
val msg = recordedMessage()
val header =
"assertion failed" + locStr +
Expand Down

0 comments on commit 73f89d0

Please sign in to comment.