diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-23T14·39+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-08-23T14·39+0000 |
commit | 4a053bfdfd85915a2a659a337bd171bc22c49138 (patch) | |
tree | 0f4f9a835d7262fac1a473b515aecf30e4a74236 /tests | |
parent | 68515b5a96d0d7c114570434f605e5077b7d3166 (diff) |
* A new primop `builtins', which returns an attribute set containing
all the primops. This allows Nix expressions to test for new primops and take appropriate action if they're not available. For instance, rather than calling a primop `foo' directly, they could say `if builtins ? foo then builtins.foo ... else ...'.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/eval-okay-builtins.exp | 1 | ||||
-rw-r--r-- | tests/lang/eval-okay-builtins.nix | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-builtins.exp b/tests/lang/eval-okay-builtins.exp new file mode 100644 index 000000000000..f4f3ba81a101 --- /dev/null +++ b/tests/lang/eval-okay-builtins.exp @@ -0,0 +1 @@ +Path("/foo") diff --git a/tests/lang/eval-okay-builtins.nix b/tests/lang/eval-okay-builtins.nix new file mode 100644 index 000000000000..e9d65e88a817 --- /dev/null +++ b/tests/lang/eval-okay-builtins.nix @@ -0,0 +1,12 @@ +assert builtins ? currentSystem; +assert !builtins ? __currentSystem; + +let { + + x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; + + y = if builtins ? fnord then builtins.fnord "foo" else ""; + + body = x + y; + +} |