Skip to content

Commit

Permalink
chore: Add tests for compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Apr 18, 2024
1 parent e91a305 commit c1b04af
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
5 changes: 3 additions & 2 deletions MODULE.bazel
Expand Up @@ -24,10 +24,11 @@ bazel_dep(
dev_dependency = True,
repo_name = "testkit",
)

git_override(
module_name = "bsp-testkit2",
commit = "4134f87a14321c0ddde9abd5c4b0de9426b471e3",
remote = "https://github.com/tgodzik/bsp-testkit2.git",
commit = "3462993c11559f36ab937286f035277692dd8cf4",
remote = "https://github.com/build-server-protocol/bsp-testkit2.git",
)

bazel_dep(
Expand Down
14 changes: 7 additions & 7 deletions MODULE.bazel.lock
@@ -1,6 +1,6 @@
{
"lockFileVersion": 3,
"moduleFileHash": "257717b0cac33d5f62908fc64650b2790839a86b1e24681a5c7f79b2c1f09651",
"moduleFileHash": "8829e7114d500844ca4a27bad9a9f07a5dd07de48a195e15c66e9b3d8913c5f4",
"flags": {
"cmdRegistries": [
"https://bcr.bazel.build/"
Expand Down Expand Up @@ -47,7 +47,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
"line": 39,
"line": 40,
"column": 31
},
"imports": {
Expand All @@ -73,7 +73,7 @@
"devDependency": true,
"location": {
"file": "@@//:MODULE.bazel",
"line": 47,
"line": 48,
"column": 24
}
},
Expand All @@ -85,7 +85,7 @@
"devDependency": true,
"location": {
"file": "@@//:MODULE.bazel",
"line": 48,
"line": 49,
"column": 24
}
},
Expand All @@ -97,7 +97,7 @@
"devDependency": true,
"location": {
"file": "@@//:MODULE.bazel",
"line": 49,
"line": 50,
"column": 24
}
}
Expand All @@ -111,7 +111,7 @@
"usingModule": "<root>",
"location": {
"file": "@@//:MODULE.bazel",
"line": 70,
"line": 71,
"column": 22
},
"imports": {
Expand Down Expand Up @@ -159,7 +159,7 @@
"devDependency": false,
"location": {
"file": "@@//:MODULE.bazel",
"line": 71,
"line": 72,
"column": 14
}
}
Expand Down
Expand Up @@ -18,14 +18,32 @@ object BazelBspScalaProjectTest : BazelBspTestBaseScenario() {
)

override fun expectedWorkspaceBuildTargetsResult(): WorkspaceBuildTargetsResult {
return WorkspaceBuildTargetsResult(listOf(BuildTarget(BuildTargetIdentifier("@//scala_targets:library"), listOf("library"), listOf("scala"), emptyList(), BuildTargetCapabilities())))
return WorkspaceBuildTargetsResult(
listOf(
BuildTarget(
BuildTargetIdentifier("@//scala_targets:library"),
listOf("library"),
listOf("scala"),
emptyList(),
BuildTargetCapabilities()
)
)
)
}


private fun scalaOptionsResults(): BazelBspTestScenarioStep {
val expectedTargetIdentifiers = expectedTargetIdentifiers().filter { it.uri != "bsp-workspace-root" }
val expectedScalaOptionsItems = expectedTargetIdentifiers.map {
ScalacOptionsItem(it, emptyList(), listOf("file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/external/io_bazel_rules_scala_scala_library/io_bazel_rules_scala_scala_library.stamp/scala-library-2.13.6-stamped.jar", "file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/external/io_bazel_rules_scala_scala_reflect/io_bazel_rules_scala_scala_reflect.stamp/scala-reflect-2.13.6-stamped.jar"), "file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/scala_targets/library.jar")
ScalacOptionsItem(
it,
emptyList(),
listOf(
"file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/external/io_bazel_rules_scala_scala_library/io_bazel_rules_scala_scala_library.stamp/scala-library-2.13.6-stamped.jar",
"file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/external/io_bazel_rules_scala_scala_reflect/io_bazel_rules_scala_scala_reflect.stamp/scala-reflect-2.13.6-stamped.jar"
),
"file://\$BAZEL_OUTPUT_BASE_PATH/execroot/__main__/bazel-out/k8-fastbuild/bin/scala_targets/library.jar"
)
}
val expectedScalaOptionsResult = ScalacOptionsResult(expectedScalaOptionsItems)
val scalaOptionsParams = ScalacOptionsParams(expectedTargetIdentifiers)
Expand Down
Expand Up @@ -9,4 +9,4 @@ object Example extends App{

sealed trait A
case class B(b: Int) extends A
case class C(c: Int) extends A
case class C(c: Int) extends A

0 comments on commit c1b04af

Please sign in to comment.