From 83af9a01292b5324de651ed90199f61be8d9eae7 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 20 Aug 2008 14:18:05 +0000 Subject: add missing files git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@687339 13f79535-47bb-0310-9956-ffa450edef68 --- test/couch_config_test.erl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/couch_config_test.erl (limited to 'test/couch_config_test.erl') 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 -- cgit v1.2.3