config: another failing test

This commit is contained in:
Carlos Martín Nieto
2014-05-19 12:50:53 +02:00
parent f568955a95
commit d6ad01836f
2 changed files with 12 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
%% API %% API
-export([start_link/1]). -export([start_link/1]).
-export([open/1]).
-export([set/3]). -export([set/3]).
%% gen_server callbacks %% gen_server callbacks

View File

@@ -3,8 +3,9 @@
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-include("src/geef_records.hrl"). -include("src/geef_records.hrl").
config_test() -> config_test_() ->
{foreach, fun start/0, fun stop/1, [fun bool_test/1]}. {foreach, fun start/0, fun stop/1, [fun bool_test/1,
fun string_test/1]}.
start() -> start() ->
{A, B, C} = now(), {A, B, C} = now(),
@@ -16,7 +17,14 @@ start() ->
bool_test({Config, _}) -> bool_test({Config, _}) ->
Var = "core.logallrefupdates", Var = "core.logallrefupdates",
ok = geef_config:set(Config, Var, true), ok = geef_config:set(Config, Var, true),
[?_assertEqual({ok, true}, geef_config:get_bool(Config, Var))]. [?_assertEqual(ok, geef_config:set(Config, Var, true)),
?_assertEqual({ok, true}, geef_config:get_bool(Config, Var))].
string_test({Config, _}) ->
Var = "user.name",
Val = <<"Random J. Hacker">>,
ok = geef_config:set(Config, Var, Val),
[?_assertEqual({ok, Val}, geef_config:get(Config, Var))].
stop({_, Path}) -> stop({_, Path}) ->
ok = file:delete(Path). ok = file:delete(Path).