Merge pull request #69345 from joachifm/feat/split-version

Replace uses of splitString for splitting version strings
This commit is contained in:
Joachim F
2019-09-27 06:19:18 +00:00
committed by GitHub
30 changed files with 59 additions and 44 deletions
+2
View File
@@ -134,5 +134,7 @@ let
mergeAttrsByFuncDefaultsClean mergeAttrBy
fakeSha256 fakeSha512
nixType imap;
inherit (versions)
splitVersion;
});
in lib
+15
View File
@@ -102,6 +102,21 @@ runTests {
expected = [ "2001" "db8" "0" "0042" "" "8a2e" "370" "" ];
};
testSplitVersionSingle = {
expr = versions.splitVersion "1";
expected = [ "1" ];
};
testSplitVersionDouble = {
expr = versions.splitVersion "1.2";
expected = [ "1" "2" ];
};
testSplitVersionTriple = {
expr = versions.splitVersion "1.2.3";
expected = [ "1" "2" "3" ];
};
testIsStorePath = {
expr =
let goodPath =
+7 -5
View File
@@ -1,14 +1,16 @@
/* Version string functions. */
{ lib }:
let
rec {
/* Break a version string into its component parts.
Example:
splitVersion "1.2.3"
=> ["1" "2" "3"]
*/
splitVersion = builtins.splitVersion or (lib.splitString ".");
in
{
/* Get the major version string from a string.
Example: