Skip to content
Snippets Groups Projects
Commit 5ad263c2 authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

Test some more primops

parent 3d0a9ec8
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@ source common.sh
export TEST_VAR=foo # for eval-okay-getenv.nix
set +x
fail=0
for i in lang/parse-fail-*.nix; do
......@@ -48,7 +50,7 @@ for i in lang/eval-okay-*.nix; do
fail=1
fi
fi
if test -e lang/$i.exp.xml; then
if ! nix-instantiate --eval --xml --no-location --strict \
lang/$i.nix > lang/$i.out.xml; then
......
......@@ -2,11 +2,6 @@ with import ./lib.nix;
let {
range = first: last:
if builtins.lessThan last first
then []
else [first] ++ range (builtins.add first 1) last;
/* Supposedly tail recursive version:
range_ = accum: first: last:
......
[ true false 30 ]
with import ./lib.nix;
let xs = range 10 40; in
[ (builtins.elem 23 xs) (builtins.elem 42 xs) (builtins.elemAt xs 20) ]
[ 0 2 4 6 8 10 100 102 104 106 108 110 ]
with import ./lib.nix;
builtins.filter
(x: x / 2 * 2 == x)
(builtins.concatLists [ (range 0 10) (range 100 110) ])
[ true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ]
[ true false true false true false true false true false true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ]
......@@ -10,6 +10,8 @@ with builtins;
(isInt { x = 123; })
(isBool (true && false))
(isBool null)
(isAttrs { x = 123; })
(isAttrs null)
(typeOf (3 * 4))
(typeOf true)
(typeOf "xyzzy")
......
......@@ -53,4 +53,9 @@ rec {
const = x: y: x;
range = first: last:
if builtins.lessThan last first
then []
else [first] ++ range (builtins.add first 1) last;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment