Skip to content

Commit 509a706

Browse files
author
Michał Wiącek
committed
add test to cover metals use case
1 parent ec8d030 commit 509a706

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import Dependencies._
2-
3-
bloopExportJarClassifiers in Global := Some(Set("sources"))
42
bloopConfigDir in Global := baseDirectory.value / "bloop-config"
53

6-
ThisBuild / scalaVersion := "2.12.9"
4+
ThisBuild / scalaVersion := "2.12.20"
75
ThisBuild / version := "0.1.0-SNAPSHOT"
86
ThisBuild / organization := "com.example"
97
ThisBuild / organizationName := "example"
108

119
lazy val root = (project in file("."))
1210
.settings(
13-
name := "Resources Test Project",
11+
name := "resources-test-project",
1412
libraryDependencies += munit % Test,
1513
fork in Test := true
1614
)

frontend/src/test/scala/bloop/bsp/BspMetalsClientSpec.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,29 @@ class BspMetalsClientSpec(
807807
}
808808
}
809809

810+
test("resource not found in tests") {
811+
TestUtil.withinWorkspace { workspace =>
812+
val logger = new RecordingLogger(ansiCodesSupported = false)
813+
val projectDir = "resources-test-project"
814+
val projectName = "root-test"
815+
loadBspBuildFromResources(
816+
projectDir,
817+
workspace,
818+
logger,
819+
"Metals"
820+
) { build =>
821+
val project = build.projectFor(projectName)
822+
val projectPath = project.baseDir
823+
val state = build.state
824+
assertNoDiff(logger.warnings.mkString(lineSeparator), "")
825+
val compiledState = state.compile(project)
826+
val testState = compiledState.test(project)
827+
assert(compiledState.status == ExitStatus.Ok)
828+
assert(testState.status == ExitStatus.Ok)
829+
}
830+
}
831+
}
832+
810833
private val dummyFooScalaSources = List(
811834
"""/Foo.scala
812835
|class Foo

frontend/src/test/scala/bloop/util/TestUtil.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -661,19 +661,4 @@ object TestUtil {
661661
DependencyResolution.Artifact("org.testng", "testng", "7.9.0")
662662
DependencyResolution.resolve(List(testNG), logger)
663663
}
664-
665-
def getMunitDep(logger: Logger) = {
666-
// TODO: figure out clean way
667-
val version =
668-
if (Properties.versionNumberString.startsWith("2.12")) {
669-
"2.12"
670-
} else if (Properties.versionNumberString.startsWith("2.13")) {
671-
"2.13"
672-
} else {
673-
"3"
674-
}
675-
val testNG =
676-
DependencyResolution.Artifact("org.scalameta", s"munit_$version", "1.1.1")
677-
DependencyResolution.resolve(List(testNG), logger)
678-
}
679664
}

0 commit comments

Comments
 (0)