Skip to content
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

Alternative way to enable fill file path names in scalactic #1795

Open
wants to merge 1 commit into
base: 3.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -57,7 +57,7 @@ notValidPosZFloat=PosZFloat.apply can only be invoked on a non-negative (n >= 0.
notLiteralPosZFloat=PosZFloat.apply can only be invoked on a floating point literal, like PosZFloat(42.0F). Please use PosZFloat.from instead.
notValidPosZDouble=PosZDouble.apply can only be invoked on a non-negative (n >= 0.0 && !n.isNaN) floating point literal, like PosZDouble(42.0).
notLiteralPosZDouble=PosZDouble.apply can only be invoked on a floating point literal, like PosZDouble(42.0). Please use PosZDouble.from instead.
pleaseDefineScalacticFillFilePathnameEnvVar=Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.
pleaseDefineScalacticFillFilePathnameEnvVar=Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.
notValidNonZeroInt=NonZeroInt.apply can only be invoked on a non-zero (n != 0) integer literal, like NonZeroInt(42).
notLiteralNonZeroInt=NonZeroInt.apply can only be invoked on an integer literal, like NonZeroInt(42). Please use NonZeroInt.from instead.
notValidNonZeroLong=NonZeroLong.apply can only be invoked on a non-zero (n != 0L) long literal, like NonZeroLong(42L).
Expand Down
Expand Up @@ -28,8 +28,11 @@ object PositionMacro {
import sourceCompatHack._

private[scalactic] lazy val showScalacticFillFilePathnames: Boolean = {
val value = System.getenv("SCALACTIC_FILL_FILE_PATHNAMES")
value != null && value == "yes"
val enabledThroughEnv = System.getenv("SCALACTIC_FILL_FILE_PATHNAMES")
val enabledThroughProp = System.getProperty("scalactic.fillFilePathnames")

(enabledThroughEnv != null && enabledThroughEnv == "yes") ||
(enabledThroughProp != null && enabledThroughProp == "yes")
}

private class PositionMacroImpl(val universe: scala.reflect.api.Universe) {
Expand Down
Expand Up @@ -63,7 +63,7 @@ class LocationSpec extends FunSpec {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert(filePathname.endsWith(s"org${sep}scalatest${sep}events${sep}LocationSpec.scala"))
else
assert(filePathname == "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert(filePathname == "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
}
}
}
Expand Down
Expand Up @@ -395,7 +395,7 @@ import StringReporter.withPossibleLineNumber
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert(result endsWith "org/scalatest/tools/StringReporterSuite.scala:" + (thisLineNumber - 3) + " **")
else
assert(result endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.:" + (thisLineNumber - 5) + " **")
assert(result endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.:" + (thisLineNumber - 5) + " **")
}

class BuilderStringReporter(presentInColor: Boolean) extends StringReporter(
Expand Down
Expand Up @@ -195,7 +195,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((scopeOpened \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((scopeOpened \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((scopeOpened \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
}

def checkTestStarting(testStarting:Elem, suiteName: String, suiteId: String, suiteClassName: Option[String],
Expand All @@ -211,7 +211,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((testStarting \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((testStarting \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((testStarting \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
checkStringOption((testStarting \ "rerunner").text, rerunner)
}

Expand All @@ -227,7 +227,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((testSucceeded \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((testSucceeded \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((testSucceeded \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
checkStringOption((testSucceeded \ "rerunner").text, rerunner)
}

Expand Down Expand Up @@ -255,7 +255,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((testPending \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((testPending \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((testPending \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
checkStringOption((testPending \ "rerunner").text, rerunner)
}

Expand All @@ -271,7 +271,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((testIgnored \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((testIgnored \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((testIgnored \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
}

def checkTestCanceled(testCanceled: Elem, message: String, suiteName: String, suiteId: String, suiteClassName: Option[String],
Expand All @@ -287,7 +287,7 @@ class XmlSocketReporterSpec extends FunSpec with Eventually {
if (System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") != null && System.getenv("SCALACTIC_FILL_FILE_PATHNAMES") == "yes")
assert((testCanceled \ "location" \ "LineInFile" \ "filePathname").text endsWith s"org${sep}scalatest${sep}tools${sep}${fileName}")
else
assert((testCanceled \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES to yes at compile time to enable this feature.")
assert((testCanceled \ "location" \ "LineInFile" \ "filePathname").text endsWith "Please set the environment variable SCALACTIC_FILL_FILE_PATHNAMES (or property scalactic.fillFilePathnames) to yes at compile time to enable this feature.")
}

def checkSuiteStarting(suiteStarting: Elem, suiteName: String, suiteId: String, suiteClassName: Option[String],
Expand Down