Software /
code /
prosody
Annotate
tests/test_core_configmanager.lua @ 7590:fd07ab702f83
net.server_epoll: Remove read timeout when waiting to read more from buffer
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 18 Aug 2016 16:12:28 +0200 |
parent | 5776:bd0ff8ae98a8 |
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 | 5 -- This project is MIT/X11 licensed. Please see the |
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 |