-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current implementation was incorrectly handling newer versions such as 2.3.0. The commit also adds unit tests for the function.
- Loading branch information
Showing
4 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
load(":utils_tests.bzl", "utils_test_suite") | ||
|
||
utils_test_suite() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Unit tests for utils.""" | ||
|
||
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") | ||
load( | ||
"//ruby/private:utils.bzl", | ||
_is_version_older = "is_version_older", | ||
) | ||
|
||
def _is_version_older_test_impl(ctx): | ||
env = unittest.begin(ctx) | ||
asserts.equals(env, _is_version_older("1.2.19", "2.2.19"), True) | ||
asserts.equals(env, _is_version_older("2.1.19", "2.2.19"), True) | ||
asserts.equals(env, _is_version_older("2.2.18", "2.2.19"), True) | ||
asserts.equals(env, _is_version_older("2.2.19", "2.2.19"), False) | ||
asserts.equals(env, _is_version_older("2.2.20", "2.2.19"), False) | ||
asserts.equals(env, _is_version_older("2.3.1", "2.2.19"), False) | ||
asserts.equals(env, _is_version_older("3.0.0", "2.2.19"), False) | ||
return unittest.end(env) | ||
|
||
is_version_older_test = unittest.make(_is_version_older_test_impl) | ||
|
||
def utils_test_suite(): | ||
unittest.suite("utils_tests", is_version_older_test) |