Skip to content

Commit

Permalink
test: introduce basic unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Jan 17, 2024
1 parent 75164ab commit 5fdc5aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ruby/tests/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load(":utils_tests.bzl", "utils_test_suite")

utils_test_suite()
18 changes: 18 additions & 0 deletions ruby/tests/utils_tests.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Unit tests for utils."""

load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
load(
"//ruby/private:utils.bzl",
_normalize_bzlmod_repository_name = "normalize_bzlmod_repository_name",
)

def _normalize_bzlmod_repository_name_test_impl(ctx):
env = unittest.begin(ctx)
asserts.equals(env, _normalize_bzlmod_repository_name("bundle"), "bundle")
asserts.equals(env, _normalize_bzlmod_repository_name("rules_ruby~override~ruby~bundle"), "bundle")
return unittest.end(env)

normalize_bzlmod_repository_name_test = unittest.make(_normalize_bzlmod_repository_name_test_impl)

def utils_test_suite():
unittest.suite("utils_tests", normalize_bzlmod_repository_name_test)

0 comments on commit 5fdc5aa

Please sign in to comment.