Annotate

tests/test_core_configmanager.lua @ 7512:7a655ff689b1

test_util_uuid: remove unused one-letter loop variable [luacheck]
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 23 Jul 2016 18:21:35 +0800
parent 5776:bd0ff8ae98a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1523
841d61be198f Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents: 896
diff changeset
1 -- Prosody IM
2923
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 1523
diff changeset
2 -- Copyright (C) 2008-2010 Matthew Wild
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 1523
diff changeset
3 -- Copyright (C) 2008-2010 Waqas Hussain
5776
bd0ff8ae98a8 Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents: 5605
diff changeset
4 --
758
b1885732e979 GPL->MIT!
Matthew Wild <mwild1@gmail.com>
parents: 615
diff changeset
5 -- This project is MIT/X11 licensed. Please see the
b1885732e979 GPL->MIT!
Matthew Wild <mwild1@gmail.com>
parents: 615
diff changeset
6 -- COPYING file in the source package for more information.
519
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 371
diff changeset
7 --
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 371
diff changeset
8
cccd610a0ef9 Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents: 371
diff changeset
9
371
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 function get(get, config)
5605
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
12 config.set("example.com", "testkey", 123);
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
13 assert_equal(get("example.com", "testkey"), 123, "Retrieving a set key");
371
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14
5605
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
15 config.set("*", "testkey1", 321);
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
16 assert_equal(get("*", "testkey1"), 321, "Retrieving a set global key");
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
17 assert_equal(get("example.com", "testkey1"), 321, "Retrieving a set key of undefined host, of which only a globally set one exists");
5776
bd0ff8ae98a8 Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents: 5605
diff changeset
18
5605
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
19 config.set("example.com", ""); -- Creates example.com host in config
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
20 assert_equal(get("example.com", "testkey1"), 321, "Retrieving a set key, of which only a globally set one exists");
5776
bd0ff8ae98a8 Remove all trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents: 5605
diff changeset
21
371
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22 assert_equal(get(), nil, "No parameters to get()");
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 assert_equal(get("undefined host"), nil, "Getting for undefined host");
5605
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
24 assert_equal(get("undefined host", "undefined key"), nil, "Getting for undefined host & key");
371
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
25 end
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
26
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
27 function set(set, u)
5605
468d7a2f85ba tests/test_core_configmanager.lua: Update to remove tests based on sections (now removed)
Matthew Wild <mwild1@gmail.com>
parents: 3540
diff changeset
28 assert_equal(set("*"), false, "Set with no key");
371
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
29
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
30 assert_equal(set("*", "set_test", "testkey"), true, "Setting a nil global value");
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
31 assert_equal(set("*", "set_test", "testkey", 123), true, "Setting a global value");
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
32 end
0dc5819660e8 Import initial configmanager, not sure if it works yet, but it does pass the unit tests ;)
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
33