github.com/bazelbuild/bazel-gazelle@v0.36.1-0.20240520142334-61b277ba6fed/internal/gazelle_binary_test.bzl (about)

     1  load("@bazel_skylib//lib:partial.bzl", "partial")
     2  load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
     3  load(":gazelle_binary.bzl", "format_call", "format_import")
     4  
     5  def _format_call_test_impl(ctx):
     6      env = unittest.begin(ctx)
     7      asserts.equals(
     8          env,
     9          "github_com_bazelbuild_bazel_skylib_gazelle_.NewLanguage()",
    10          format_call("github.com/bazelbuild/bazel-skylib/gazelle"),
    11      )
    12      return unittest.end(env)
    13  
    14  def _format_import_test_impl(ctx):
    15      env = unittest.begin(ctx)
    16      asserts.equals(
    17          env,
    18          "github_com_bazelbuild_bazel_skylib_gazelle_ \"github.com/bazelbuild/bazel-skylib/gazelle\"",
    19          format_import("github.com/bazelbuild/bazel-skylib/gazelle"),
    20      )
    21      return unittest.end(env)
    22  
    23  _format_call_test = unittest.make(_format_call_test_impl)
    24  _format_import_test = unittest.make(_format_import_test_impl)
    25  
    26  def gazelle_binary_test_suite():
    27      unittest.suite(
    28          "gazelle_binary_tests",
    29          partial.make(_format_call_test, size = "small"),
    30          partial.make(_format_import_test, size = "small"),
    31      )