about summary refs log tree commit diff
path: root/tests/lang/eval-okay-context-introspection.nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-02-12T16·57+0100
committerGitHub <noreply@github.com>2019-02-12T16·57+0100
commit7a7ec2229834aa294b3e09df7f514b7134287ec2 (patch)
tree4c704e904b9ed21536ceb39632e61d7c78b2917b /tests/lang/eval-okay-context-introspection.nix
parent01d07b1e92c298f729a73705907b2987da9a4d0c (diff)
parentb30be6b450f872f8be6dc8afa28f4b030fa8d1d1 (diff)
Merge pull request #2628 from shlevy/context-introspection
Context introspection
Diffstat (limited to 'tests/lang/eval-okay-context-introspection.nix')
-rw-r--r--tests/lang/eval-okay-context-introspection.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-context-introspection.nix b/tests/lang/eval-okay-context-introspection.nix
new file mode 100644
index 000000000000..43178bd2eef9
--- /dev/null
+++ b/tests/lang/eval-okay-context-introspection.nix
@@ -0,0 +1,24 @@
+let
+  drv = derivation {
+    name = "fail";
+    builder = "/bin/false";
+    system = "x86_64-linux";
+    outputs = [ "out" "foo" ];
+  };
+
+  path = "${./eval-okay-context-introspection.nix}";
+
+  desired-context = {
+    "${builtins.unsafeDiscardStringContext path}" = {
+      path = true;
+    };
+    "${builtins.unsafeDiscardStringContext drv.drvPath}" = {
+      outputs = [ "foo" "out" ];
+      allOutputs = true;
+    };
+  };
+
+  legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
+
+  constructed-context = builtins.getContext (builtins.appendContext "" desired-context);
+in legit-context == constructed-context