summaryrefslogtreecommitdiffstats
path: root/kjsembed/tests/test_kconfig.js
diff options
context:
space:
mode:
Diffstat (limited to 'kjsembed/tests/test_kconfig.js')
-rwxr-xr-xkjsembed/tests/test_kconfig.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/kjsembed/tests/test_kconfig.js b/kjsembed/tests/test_kconfig.js
new file mode 100755
index 00000000..519f13fb
--- /dev/null
+++ b/kjsembed/tests/test_kconfig.js
@@ -0,0 +1,40 @@
+#!/usr/bin/env kjscmd
+
+var confName = "jsconfigrc";
+var groupName = "Blah";
+
+var conf = new Config(this, confName);
+
+var grp = conf.group();
+
+println( "Group=" + grp );
+
+conf.setGroup(groupName);
+conf.writeColorEntry("Test Color", "blue");
+conf.writeListEntry("Test Array", ["A Value","B Value", "C Value"]);
+conf.writeEntry("Test Text", "this is a test");
+conf.sync();
+
+var newData = conf.readListEntry("Test Array");
+var newColor = conf.readColorEntry("Test Color");
+var newText = conf.readEntry("Test Text");
+println("Reread Active Config");
+println("Groups: " + conf.groupList());
+println(newData);
+println(newColor);
+println(newText);
+
+
+var newConf = new Config(this, confName);
+println("Reread Saved Config");
+println("Groups: " + newConf.groupList());
+newConf.setGroup(groupName);
+
+newData = newConf.readListEntry("Test Array");
+newColor = newConf.readColorEntry("Test Color", "red");
+newText = newConf.readEntry("Test Text", "Wrong Text");
+
+println(newData);
+println(newColor);
+println(newText);
+