aboutsummaryrefslogtreecommitdiff
path: root/tests/lang/eval-okay-context-introspection.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-23 11:47:20 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-23 11:47:20 -0500
commitc67e0cc58c5a74121d74a3f5cf9f9c2199a87093 (patch)
tree79454c245dbb0330b619bc653332077f04d3100b /tests/lang/eval-okay-context-introspection.nix
parentb3d91239ae9f21a60057b278ceeff663fb786246 (diff)
parent9b56683398de777219627c96be75c0195e630cb7 (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'tests/lang/eval-okay-context-introspection.nix')
-rw-r--r--tests/lang/eval-okay-context-introspection.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/lang/eval-okay-context-introspection.nix b/tests/lang/eval-okay-context-introspection.nix
index 43178bd2e..50a78d946 100644
--- a/tests/lang/eval-okay-context-introspection.nix
+++ b/tests/lang/eval-okay-context-introspection.nix
@@ -18,7 +18,24 @@ let
};
};
- legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
+ combo-path = "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
+ legit-context = builtins.getContext combo-path;
- constructed-context = builtins.getContext (builtins.appendContext "" desired-context);
-in legit-context == constructed-context
+ reconstructed-path = builtins.appendContext
+ (builtins.unsafeDiscardStringContext combo-path)
+ desired-context;
+
+ # Eta rule for strings with context.
+ etaRule = str:
+ str == builtins.appendContext
+ (builtins.unsafeDiscardStringContext str)
+ (builtins.getContext str);
+
+in [
+ (legit-context == desired-context)
+ (reconstructed-path == combo-path)
+ (etaRule "foo")
+ (etaRule drv.drvPath)
+ (etaRule drv.foo.outPath)
+ (etaRule (builtins.unsafeDiscardOutputDependency drv.drvPath))
+]