about summary refs log tree commit diff
path: root/tests/restricted.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-14T13·24+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-14T13·24+0200
commitfc6a03298989383aa6d4562b51820d45a0f728eb (patch)
tree62cc6d23ec8d448f6bab74c4e0c44a9daae368c8 /tests/restricted.sh
parent3c1c6b8f0015a04b4bc156e2d632ceae183fce89 (diff)
Add tests for restricted eval mode
Diffstat (limited to 'tests/restricted.sh')
-rw-r--r--tests/restricted.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/restricted.sh b/tests/restricted.sh
new file mode 100644
index 0000000000..19096a9f8d
--- /dev/null
+++ b/tests/restricted.sh
@@ -0,0 +1,18 @@
+source common.sh
+
+clearStore
+
+nix-instantiate --option restrict-eval true --eval -E '1 + 2'
+(! nix-instantiate --option restrict-eval true ./simple.nix)
+nix-instantiate --option restrict-eval true ./simple.nix -I src=.
+nix-instantiate --option restrict-eval true ./simple.nix -I src1=simple.nix -I src2=config.nix -I src3=./simple.builder.sh
+
+(! nix-instantiate --option restrict-eval true --eval -E 'builtins.readFile ./simple.nix')
+nix-instantiate --option restrict-eval true --eval -E 'builtins.readFile ./simple.nix' -I src=..
+
+(! nix-instantiate --option restrict-eval true --eval -E 'builtins.readDir ../src/boost')
+nix-instantiate --option restrict-eval true --eval -E 'builtins.readDir ../src/boost' -I src=../src
+
+(! nix-instantiate --option restrict-eval true --eval -E 'let __nixPath = [ { prefix = "foo"; path = ./.; } ]; in <foo>')
+nix-instantiate --option restrict-eval true --eval -E 'let __nixPath = [ { prefix = "foo"; path = ./.; } ]; in <foo>' -I src=.
+