feat(flake): Add unit testing
Change-Id: Idc9bbca0e752b21a5293e2ad4819da9af42ca8ca
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/782
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/lib/strings/default.nix b/lib/strings/default.nix
index dccb09f..ca056e0 100644
--- a/lib/strings/default.nix
+++ b/lib/strings/default.nix
@@ -11,5 +11,14 @@
prefixLength = lib.strings.commonPrefixLength a b;
in
builtins.substring 0 prefixLength a;
+
+ endsWith = suffix: str: let
+ suffixLength = builtins.stringLength suffix;
+ strLength = builtins.stringLength str;
+
+ suffixStart = strLength - suffixLength;
+
+ maybeSuffix = builtins.substring suffixStart strLength str;
+ in suffixStart >= 0 && maybeSuffix == suffix;
};
}