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

Fix printed file path in PrintingTest.scala #8292

Closed
wants to merge 147 commits into from
Closed

Fix printed file path in PrintingTest.scala #8292

wants to merge 147 commits into from

Conversation

michelou
Copy link
Contributor

This fix solves one test case among several tests still failing on Windows (Win10/Java 8).

> sbt "testOnly dotty.tools.dotc.PrintingTest"
[info] Loading settings for project dotty-build-build from build.sbt ...
[info] Loading project definition from W:\dotty\project\project
[info] Loading settings for project dotty-build from build.sbt,plugins.sbt ...
[info] Loading project definition from W:\dotty\project
[info] Loading settings for project dotty from build.sbt ...
[info] Resolving key references (25620 settings) ...
[info] Set current project to dotty (in build file:/W:/dotty/)
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-interfaces / Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-library / Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for tasty-core / Test / testOnly
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for Test / testOnly
[info] Compiling 1 Scala source to W:\dotty\compiler\target\scala-0.22\test-classes ...
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-sbt-bridge / Test / testOnly
[info] Test run started
[info] Test dotty.tools.dotc.PrintingTest.printing started
Output from 'tests\printing\i620.scala' did not match check file. Actual output:
result of tests\printing\i620.scala after typer:
package O {
  package O.A {
    class D() extends Object() {
      class C() extends Object() {
        protected[D] def a: Int = 0
        private[D] def b: Int = 0
        private[this] def c: Int = 0
        protected def d: Int = 0
        private[A] def e: Int = 0
        protected[A] def f: Int = 0
        def g: Int = 0
        def g1(t: Int): Int = 0
        def (c: D.this.C) g1: Int = 0
      }
      private[D] class E() extends Object() {}
      private[this] class F() extends Object() {}
      private[A] class G() extends Object() {}
      protected[D] class H() extends Object() {}
      protected class I() extends Object() {}
      protected[A] class J() extends Object() {}
      class K() extends Object() {}
      protected[D] val a: Int = 0
      private[D] val b: Int = 0
      private[this] val c: Int = 0
      protected val d: Int = 0
      private[A] val e: Int = 0
      protected[A] val f: Int = 0
      val g: Int = 0
    }
  }
}


[error] Test dotty.tools.dotc.PrintingTest.printing failed: java.lang.AssertionError: assertion failed: Pass: 0, Failed: 1, took 4.0 sec
Test output dumped in: tests\printing\i620.check.out
  See diff of the checkfile (`brew install icdiff` for colored diff)
    > diff tests\printing\i620.check tests\printing\i620.check.out
  Replace checkfile with current output
    > mv tests\printing\i620.check.out tests\printing\i620.check

[error]     at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
[error]     at dotty.tools.dotc.PrintingTest.printing(PrintingTest.scala:59)
[error]     ...
[info] Test run finished: 1 failed, 0 ignored, 1 total, 4.391s
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error]         dotty.tools.dotc.PrintingTest
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-doc / Test / testOnly
[error] (dotty-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 19 s, completed 11 Feb 2020 21:28:11

On Windows both files differ only in the first line for test i620.scala :

  • 1st line in check file: result of tests/printing/i620.scala after typer:
  • 1st line in output file: result of tests\printing\i620.scala after typer:

Replacing selectively the file separator on Windows does solve the issue:

> sbt "testOnly dotty.tools.dotc.PrintingTest"
[info] Loading settings for project dotty-i620-build-build from build.sbt ...
[info] Loading project definition from W:\dotty-i620\project\project
[info] Loading settings for project dotty-i620-build from build.sbt,plugins.sbt ...
[info] Loading project definition from W:\dotty-i620\project
[info] Loading settings for project dotty from build.sbt ...
[info] Resolving key references (25620 settings) ...
[info] Set current project to dotty (in build file:/W:/dotty-i620/)
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-library / Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-interfaces / Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for tasty-core / Test / testOnly
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-sbt-bridge / Test / testOnly
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for dotty-doc / Test / testOnly
[info] Test run started
[info] Test dotty.tools.dotc.PrintingTest.printing started
Pass: 1, Failed: 0
[info] Test run finished: 0 failed, 0 ignored, 1 total, 4.0s
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[success] Total time: 12 s, completed 11 Feb 2020 21:25:30

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, LGTM

val jOutFilePath = Paths.get(baseFilePath + ".check.out")
if (Files.exists(jOutFilePath))
try { Files.delete(jOutFilePath) } catch { case _: Exception => () }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be better to remove the file in FileDiff.checkAndDump?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I can do it in FileDiff.checkAndDump.

I'll move the code.

@liufengyun
Copy link
Contributor

LGTM 👍

Maybe rebase to remove histories like Merge remote-tracking branch 'upstream/master' into dotty-i620.

odersky and others added 18 commits February 14, 2020 17:24
It is `given _`, or `given Type`, never `given` alone.
It's now `:` instead of the trailing `with`.
Add a doc page to explain how the syntax of previous Dotty versions
changed in 0.22.
* Use inline parameters
* Stop using underlyingArgument
* Use throwError
Change syntax of context functions to `(using x: T) => E`. The previous
syntax `(x: T) ?=> E` is still supported, but the docs have been changed
to `using`.
liufengyun and others added 28 commits February 14, 2020 17:25
Promote is more semantically correct than Leak: leaking means
something bad, but promotion is neutral or positive. A warning
may be reported if the promotion is unsafe.
ErasedFunctionX does not have constructors, thus no need to follow.

dotc -d out -Yerased-terms -Ycheck-init tests/run-custom-args/erased/erased-15.scala
dotc -d out -Ycheck-init  tests/run/vc-equals.scala
dotc -d out -Ycheck-init tests/pos/aliasNew.scala
The method name is not an invariant:

dotc -d out -Ycheck-init tests/pos/i4350.scala
dotc -d out -Ycheck-init tests/pos/SI-4012-b.scala
dotc -d out -Ycheck-init tests/run/polymorphic-functions.scala
dotc -d out -Ycheck-init tests/pos/annot.scala
It should return a tuple of effects and potentials due to length limit.
Previously, the effects are checked but the errors are thrown away.
Limit the buffer size on clear so that pathological
strings or comments don't permanently allocate.
@odersky odersky closed this Feb 15, 2020
@michelou michelou deleted the dotty-i620 branch February 15, 2020 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants