aboutsummaryrefslogtreecommitdiff
path: root/tests/lang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lang')
-rw-r--r--tests/lang/eval-okay-context-introspection.exp2
-rw-r--r--tests/lang/eval-okay-context-introspection.nix23
-rw-r--r--tests/lang/eval-okay-readDir.exp2
-rw-r--r--tests/lang/eval-okay-readFileType.exp1
-rw-r--r--tests/lang/eval-okay-readFileType.nix6
l---------tests/lang/readDir/ldir1
l---------tests/lang/readDir/linked1
7 files changed, 31 insertions, 5 deletions
diff --git a/tests/lang/eval-okay-context-introspection.exp b/tests/lang/eval-okay-context-introspection.exp
index 27ba77dda..03b400cc8 100644
--- a/tests/lang/eval-okay-context-introspection.exp
+++ b/tests/lang/eval-okay-context-introspection.exp
@@ -1 +1 @@
-true
+[ true true true true true true ]
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))
+]
diff --git a/tests/lang/eval-okay-readDir.exp b/tests/lang/eval-okay-readDir.exp
index bf8d2c14e..6413f6d4f 100644
--- a/tests/lang/eval-okay-readDir.exp
+++ b/tests/lang/eval-okay-readDir.exp
@@ -1 +1 @@
-{ bar = "regular"; foo = "directory"; }
+{ bar = "regular"; foo = "directory"; ldir = "symlink"; linked = "symlink"; }
diff --git a/tests/lang/eval-okay-readFileType.exp b/tests/lang/eval-okay-readFileType.exp
new file mode 100644
index 000000000..6413f6d4f
--- /dev/null
+++ b/tests/lang/eval-okay-readFileType.exp
@@ -0,0 +1 @@
+{ bar = "regular"; foo = "directory"; ldir = "symlink"; linked = "symlink"; }
diff --git a/tests/lang/eval-okay-readFileType.nix b/tests/lang/eval-okay-readFileType.nix
new file mode 100644
index 000000000..174fb6c3a
--- /dev/null
+++ b/tests/lang/eval-okay-readFileType.nix
@@ -0,0 +1,6 @@
+{
+ bar = builtins.readFileType ./readDir/bar;
+ foo = builtins.readFileType ./readDir/foo;
+ linked = builtins.readFileType ./readDir/linked;
+ ldir = builtins.readFileType ./readDir/ldir;
+}
diff --git a/tests/lang/readDir/ldir b/tests/lang/readDir/ldir
new file mode 120000
index 000000000..191028156
--- /dev/null
+++ b/tests/lang/readDir/ldir
@@ -0,0 +1 @@
+foo \ No newline at end of file
diff --git a/tests/lang/readDir/linked b/tests/lang/readDir/linked
new file mode 120000
index 000000000..c503f86a0
--- /dev/null
+++ b/tests/lang/readDir/linked
@@ -0,0 +1 @@
+foo/git-hates-directories \ No newline at end of file