about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-11-25 00:23:07 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2019-11-25 00:23:07 +0000
commit6bc456c91c6a556e905852d9a13034ed1932ea3d (patch)
tree69df19159e5e7df77ae939041f8f6e941c5ef056 /lib/tests
parentea9a2c5ec21bf088bbdef036238fa67cdc85b073 (diff)
parent4273a6adcc9327b9dc0e09e9fe205b4861c15679 (diff)
downloadnixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar.gz
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar.bz2
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar.lz
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar.xz
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.tar.zst
nixlib-6bc456c91c6a556e905852d9a13034ed1932ea3d.zip
Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/misc.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index d8f412d3fc49..b064faa1e1ba 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -18,6 +18,31 @@ runTests {
     expected = 2;
   };
 
+  testPipe = {
+    expr = pipe 2 [
+      (x: x + 2) # 2 + 2 = 4
+      (x: x * 2) # 4 * 2 = 8
+    ];
+    expected = 8;
+  };
+
+  testPipeEmpty = {
+    expr = pipe 2 [];
+    expected = 2;
+  };
+
+  testPipeStrings = {
+    expr = pipe [ 3 4 ] [
+      (map toString)
+      (map (s: s + "\n"))
+      concatStrings
+    ];
+    expected = ''
+      3
+      4
+    '';
+  };
+
   /*
   testOr = {
     expr = or true false;
@@ -102,6 +127,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 =