diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/lib/tests/misc.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/lib/tests/misc.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/lib/tests/misc.nix b/infra/libkookie/nixpkgs/lib/tests/misc.nix index 3a6db53c276d..35a5801c724f 100644 --- a/infra/libkookie/nixpkgs/lib/tests/misc.nix +++ b/infra/libkookie/nixpkgs/lib/tests/misc.nix @@ -87,6 +87,26 @@ runTests { expected = true; }; + testComposeManyExtensions0 = { + expr = let obj = makeExtensible (self: { foo = true; }); + emptyComposition = composeManyExtensions []; + composed = obj.extend emptyComposition; + in composed.foo; + expected = true; + }; + + testComposeManyExtensions = + let f = self: super: { bar = false; baz = true; }; + g = self: super: { bar = super.baz or false; }; + h = self: super: { qux = super.bar or false; }; + obj = makeExtensible (self: { foo = self.qux; }); + in { + expr = let composition = composeManyExtensions [f g h]; + composed = obj.extend composition; + in composed.foo; + expected = (obj.extend (composeExtensions f (composeExtensions g h))).foo; + }; + testBitAnd = { expr = (bitAnd 3 10); expected = 2; @@ -154,6 +174,20 @@ runTests { expected = [ "2001" "db8" "0" "0042" "" "8a2e" "370" "" ]; }; + testSplitStringsRegex = { + expr = strings.splitString "\\[{}]()^$?*+|." "A\\[{}]()^$?*+|.B"; + expected = [ "A" "B" ]; + }; + + testSplitStringsDerivation = { + expr = take 3 (strings.splitString "/" (derivation { + name = "name"; + builder = "builder"; + system = "system"; + })); + expected = ["" "nix" "store"]; + }; + testSplitVersionSingle = { expr = versions.splitVersion "1"; expected = [ "1" ]; |