summaryrefslogtreecommitdiff
path: root/test/couch_config_test.erl
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2008-08-20 14:18:05 +0000
committerJan Lehnardt <jan@apache.org>2008-08-20 14:18:05 +0000
commit83af9a01292b5324de651ed90199f61be8d9eae7 (patch)
treecce4408d58132b37f620e033ccc0c2fac57d93ae /test/couch_config_test.erl
parent4700dd67f03c020c3799a4bf161eadfacbf420cb (diff)
add missing files
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@687339 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/couch_config_test.erl')
-rw-r--r--test/couch_config_test.erl43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/couch_config_test.erl b/test/couch_config_test.erl
new file mode 100644
index 00000000..b9dc71ad
--- /dev/null
+++ b/test/couch_config_test.erl
@@ -0,0 +1,43 @@
+% couch_config module test suote
+
+% Set up test suite
+% ?MODULE_test() returns a list of functions
+% that run the actual tests.
+couch_config_test() ->
+ [
+ fun() -> store_tuples() end,
+ fun() -> store_strings() end,
+ fun() -> store_numbers() end,
+ fun() -> store_tuple_key() end
+ ].
+
+
+% test functions
+
+% test storing different types and see if they come back
+% the same way there put in.
+store_tuples() ->
+ store(key, value).
+
+store_strings() ->
+ store("key", "value").
+
+store_numbers() ->
+ store("number_key", 12345).
+
+store_tuple_key() ->
+ store({key, subkey}, value).
+
+
+store(Key2, Value2) ->
+ Key = binary_to_list(term_to_binary(Key2)),
+ Value = binary_to_list(term_to_binary(Value2)),
+
+ couch_config:start_link(["couch.ini"]),
+
+ couch_config:store({"test_module", Key}, Value),
+ Result = couch_config:get({"test_module", Key}),
+ couch_config:unset(Key),
+
+ couch_config:terminate(end_of_test, ok),
+ Value = Result. \ No newline at end of file