diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-07-14 18:18:48 +0200 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-07-14 19:36:45 +0200 |
commit | bc8fbc25723b05e0f909faa6589641867200775b (patch) | |
tree | 5f19cfd37b053399fc51ceb1f045cec496d5bf4b /lib/tests/misc.nix | |
parent | a4f7840e1813bc389995083fac2b3bcd0ca6823d (diff) | |
download | nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar.gz nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar.bz2 nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar.lz nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar.xz nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.tar.zst nixpkgs-bc8fbc25723b05e0f909faa6589641867200775b.zip |
lib.lists.hasPrefix: init
Diffstat (limited to 'lib/tests/misc.nix')
-rw-r--r-- | lib/tests/misc.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index ce980436c1b..5c824a066e1 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -480,6 +480,27 @@ runTests { ([ 1 2 3 ] == (take 4 [ 1 2 3 ])) ]; + testListHasPrefixExample1 = { + expr = lists.hasPrefix [ 1 2 ] [ 1 2 3 4 ]; + expected = true; + }; + testListHasPrefixExample2 = { + expr = lists.hasPrefix [ 0 1 ] [ 1 2 3 4 ]; + expected = false; + }; + testListHasPrefixLazy = { + expr = lists.hasPrefix [ 1 ] [ 1 (abort "lib.lists.hasPrefix is not lazy") ]; + expected = true; + }; + testListHasPrefixEmptyPrefix = { + expr = lists.hasPrefix [ ] [ 1 2 ]; + expected = true; + }; + testListHasPrefixEmptyList = { + expr = lists.hasPrefix [ 1 2 ] [ ]; + expected = false; + }; + testFoldAttrs = { expr = foldAttrs (n: a: [n] ++ a) [] [ { a = 2; b = 7; } |