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

Update to run all tests for Dotty, one fails #92

Merged
merged 5 commits into from
Oct 16, 2020
Merged
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
26 changes: 4 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ val scalacOpts = List(

val dotcOpts = List("-Xdiags:verbose")

ThisBuild / Compile / scalacOptions := {
Compile / scalacOptions := {
if (isDotty.value) dotcOpts else scalacOpts
}
ThisBuild / Test / scalacOptions := {
Test / scalacOptions := {
if (isDotty.value) dotcOpts else scalacOpts
}

scalacOptions in (Compile, console) --= Seq(
Compile / console / scalacOptions --= Seq(
"-Ywarn-unused:imports",
"-Xfatal-warnings"
)
Expand Down Expand Up @@ -110,6 +110,7 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform)
.withDottyCompat(scalaVersion.value)
)
.jvmSettings(
crossScalaVersions := versionsJVM,
sharedJvmNativeSource,
libraryDependencies ++= Seq(
"io.crashbox" %% "spray-json" % "1.3.5-7" % Test,
Expand All @@ -123,28 +124,9 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform)
"-g",
"-Xlint:unchecked"
),
// Dotty is missing serializable support
// Can Filter based on Test name but not method name with "erializ"
// so exclude the Tests with the 19 that cannot pass
// 530 - 19 = 511 Only 346 get run this way so we lose coverage
Test / testOptions := {
if (isDotty.value)
Seq(
Tests.Exclude(
Seq(
"org.ekrich.config.impl.ValidationTest",
"org.ekrich.config.impl.PublicApiTest",
"org.ekrich.config.impl.ConfigValueTest",
"org.ekrich.config.impl.ConfigTest"
)
)
)
else Seq(Tests.Exclude(Seq()))
},
// because we test some global state such as singleton caches,
// we have to run tests in serial.
Test / parallelExecution := false,
test / fork := true,
Test / fork := true,
run / fork := true,
Test / run / fork := true,
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.0
sbt.version=1.3.13
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,10 @@ abstract trait TestUtils {
.sortBy(_.path)
.sortBy(_.origin.lineNumber)

//for (problem <- problems)
// System.err.println(problem.origin.description() + ": " + problem.path() + ": " + problem.problem())
// for (problem <- problems)
// System.err.println(
// problem.origin.description + ": " + problem.path + ": " + problem.problem
// )

for ((problem, expected) <- problems zip expecteds) {
expected.check(problem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,14 @@ class ValidationTest extends TestUtils {
checkValidationException(e, expecteds)
}

@Test
@Test @Ignore("https://github.com/lampepfl/dotty/issues/9881")
def validationFailedSerializable(): Unit = {
// Reusing a previous test case to generate an error
val reference = parseConfig("""{ a : [{},{},{}] }""")
val conf = parseConfig("""{ a : 42 }""")
val e = intercept[ConfigException.ValidationFailed] {
conf.checkValid(reference)
}

val expecteds = Seq(WrongType("a", 1, "list", "number"))

val actual = checkSerializableNoMeaningfulEquals(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ object ConfigException {
origin: ConfigOrigin
): Unit = {
// circumvent "final"
var f: Field = null
try {
f = clazz.getDeclaredField("origin");
} catch {
case e: NoSuchFieldException =>
throw new IOException(clazz.getSimpleName + " has no origin field?", e)
case e: SecurityException =>
throw new IOException(
"unable to fill out origin field in " + clazz.getSimpleName,
e
)
}
val f: Field =
try {
clazz.getDeclaredField("origin");
} catch {
case e: NoSuchFieldException =>
throw new IOException(
clazz.getSimpleName + " has no origin field?",
e
)
case e: SecurityException =>
throw new IOException(
"unable to fill out origin field in " + clazz.getSimpleName,
e
)
}

f.setAccessible(true)
try {
Expand Down