Skip to content

Commit

Permalink
Implement better test class inference. (#516)
Browse files Browse the repository at this point in the history
Currently supported:-

//foo/bar:BazTest

Now additionally support paths within packages that are often generated by test suite macros.

//foo:bar/BazTest
  • Loading branch information
jongerrish authored Apr 1, 2021
1 parent 5357ac1 commit f184141
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kotlin/internal/jvm/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ def kt_jvm_junit_test_impl(ctx):
# If no test_class, do a best-effort attempt to infer one.
if not bool(ctx.attr.test_class):
for file in ctx.files.srcs:
if file.basename.split(".")[0] == ctx.attr.name:
package_relative_path = file.path.replace(ctx.label.package + "/", "")
if package_relative_path.split(".")[0] == ctx.attr.name:
for splitter in _SPLIT_STRINGS:
elements = file.short_path.split(splitter, 1)
if len(elements) == 2:
Expand Down

0 comments on commit f184141

Please sign in to comment.