about summary refs log tree commit diff
path: root/tests/plugins
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-02-13T19·43-0500
committerShea Levy <shea@shealevy.com>2018-02-13T19·43-0500
commitde4934ab3b26aa851b7044e9884102cc054dc092 (patch)
tree94e333d35b7d48d93bfb70f132023d6b8d3d5752 /tests/plugins
parent3fe9767dd33499c2560d209dc13a01f5fcead1f0 (diff)
Allow plugins to define new settings.
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/plugintest.cc13
1 files changed, 11 insertions, 2 deletions
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);