aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lang/eval-okay-import.exp1
-rw-r--r--tests/lang/eval-okay-import.nix11
-rw-r--r--tests/lang/imported.nix3
-rw-r--r--tests/lang/imported2.nix1
4 files changed, 16 insertions, 0 deletions
diff --git a/tests/lang/eval-okay-import.exp b/tests/lang/eval-okay-import.exp
new file mode 100644
index 000000000..c508125b5
--- /dev/null
+++ b/tests/lang/eval-okay-import.exp
@@ -0,0 +1 @@
+[ 1 2 3 4 5 6 7 8 9 10 ]
diff --git a/tests/lang/eval-okay-import.nix b/tests/lang/eval-okay-import.nix
new file mode 100644
index 000000000..0b18d9413
--- /dev/null
+++ b/tests/lang/eval-okay-import.nix
@@ -0,0 +1,11 @@
+let
+
+ overrides = {
+ import = fn: scopedImport overrides fn;
+
+ scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
+
+ builtins = builtins // overrides;
+ } // import ./lib.nix;
+
+in scopedImport overrides ./imported.nix
diff --git a/tests/lang/imported.nix b/tests/lang/imported.nix
new file mode 100644
index 000000000..fb39ee4ef
--- /dev/null
+++ b/tests/lang/imported.nix
@@ -0,0 +1,3 @@
+# The function ‘range’ comes from lib.nix and was added to the lexical
+# scope by scopedImport.
+range 1 5 ++ import ./imported2.nix
diff --git a/tests/lang/imported2.nix b/tests/lang/imported2.nix
new file mode 100644
index 000000000..6d0a2992b
--- /dev/null
+++ b/tests/lang/imported2.nix
@@ -0,0 +1 @@
+range 6 10