From 206d20426cb2959aab8cc3cfc8e62aa68bc7b52f Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 17 Oct 2023 01:12:49 +0200 Subject: lib.strings: add `replicate` `strings.replicate` returns n copies of a string, concatenated into a new string Co-authored-by: Silvan Mosberger --- lib/tests/misc.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/tests/misc.nix') diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 2e7fda2b1f8..1fb857a65e9 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -191,6 +191,11 @@ runTests { expected = "a\nb\nc\n"; }; + testReplicateString = { + expr = strings.replicate 5 "hello"; + expected = "hellohellohellohellohello"; + }; + testSplitStringsSimple = { expr = strings.splitString "." "a.b.c.d"; expected = [ "a" "b" "c" "d" ]; -- cgit 1.4.1