about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-02-19T12·58+0100
committerEelco Dolstra <edolstra@gmail.com>2018-02-19T12·58+0100
commit75a1d96cfd931e6e598040f5961d6d33f417ba56 (patch)
treee995eeaf138895275a69a7050507ef9c94f098b4 /tests
parent7fe5910bf8a9d104354df14b6b2faa69a6718e70 (diff)
parentde4934ab3b26aa851b7044e9884102cc054dc092 (diff)
Merge branch 'register-settings' of https://github.com/shlevy/nix
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins.sh2
-rw-r--r--tests/plugins/plugintest.cc13
2 files changed, 12 insertions, 3 deletions
diff --git a/tests/plugins.sh b/tests/plugins.sh
index 0fad4f773a28..4b1baeddce32 100644
--- a/tests/plugins.sh
+++ b/tests/plugins.sh
@@ -2,6 +2,6 @@ source common.sh
 
 set -o pipefail
 
-res=$(nix eval '(builtins.anotherNull)' --option plugin-files $PWD/plugins/libplugintest*)
+res=$(nix eval '(builtins.anotherNull)' --option setting-set true --option plugin-files $PWD/plugins/libplugintest*)
 
 [ "$res"x = "nullx" ]
diff --git a/tests/plugins/plugintest.cc b/tests/plugins/plugintest.cc
index 6b5e6d7cde21..8da15ebabd7d 100644
--- a/tests/plugins/plugintest.cc
+++ b/tests/plugins/plugintest.cc
@@ -1,10 +1,19 @@
+#include "globals.hh"
 #include "primops.hh"
 
 using namespace nix;
 
+static BaseSetting<bool> settingSet{false, "setting-set",
+        "Whether the plugin-defined setting was set"};
+
+static RegisterSetting rs(&settingSet);
+
 static void prim_anotherNull (EvalState & state, const Pos & pos, Value ** args, Value & v)
 {
-    mkNull(v);
+    if (settingSet)
+        mkNull(v);
+    else
+        mkBool(v, false);
 }
 
-static RegisterPrimOp r("anotherNull", 0, prim_anotherNull);
+static RegisterPrimOp rp("anotherNull", 0, prim_anotherNull);