[go: nahoru, domu]

Skip to content

Commit

Permalink
Change a structural type to nominal
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Nov 16, 2020
1 parent f7f480f commit 00fc3a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.enso.runtimeversionmanager.releases.{
}
import org.enso.runtimeversionmanager.test.{
FakeEnvironment,
HasTestDirectory,
TestLocalLockManager
}

Expand All @@ -44,7 +45,8 @@ class TestDistributionConfiguration(
override val engineReleaseProvider: ReleaseProvider[EngineRelease],
runtimeReleaseProvider: GraalVMRuntimeReleaseProvider
) extends DistributionConfiguration
with FakeEnvironment {
with FakeEnvironment
with HasTestDirectory {

def getTestDirectory: Path = distributionRoot

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.enso.runtimeversionmanager.{Environment, FileSystem}
* which points to an Enso installation inside the temporary directory
* generated for the test.
*/
trait FakeEnvironment { self: { def getTestDirectory: Path } =>
trait FakeEnvironment { self: HasTestDirectory =>

/** Returns a fake path to the Enso executable that is inside the temporary
* directory for the test.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.enso.runtimeversionmanager.test

import java.nio.file.Path

trait HasTestDirectory {

/** Defines a (usually temporary) that is to be used for this test. */
def getTestDirectory: Path
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import org.scalatest.{BeforeAndAfterEach, Suite}

/** Creates a separate temporary directory for each test.
*/
trait WithTemporaryDirectory extends Suite with BeforeAndAfterEach {
trait WithTemporaryDirectory
extends Suite
with BeforeAndAfterEach
with HasTestDirectory {
private var testDirectory: Path = _

/** @inheritdoc
Expand All @@ -25,8 +28,7 @@ trait WithTemporaryDirectory extends Suite with BeforeAndAfterEach {
robustDeleteDirectory(testDirectory.toFile)
}

/** Returns the temporary directory for this test.
*/
/** Returns the temporary directory for this test. */
def getTestDirectory: Path = testDirectory.toAbsolutePath.normalize

/** Tries to remove the directory, retrying every 100ms for 3 seconds.
Expand Down

0 comments on commit 00fc3a2

Please sign in to comment.