From: Siraaj Khandkar <siraaj@khandkar.net>
Date: Tue, 12 Aug 2014 18:26:09 +0000 (-0400)
Subject: Add tests for hope_kv_list:set/3
X-Git-Tag: 1.0.0~24
X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=39273fbe5d3bb9501b22e98d313a72d9fb4ea2ea;p=hope.git

Add tests for hope_kv_list:set/3
---

diff --git a/test/hope_kv_list_SUITE.erl b/test/hope_kv_list_SUITE.erl
index 65d4d1f..98c5489 100644
--- a/test/hope_kv_list_SUITE.erl
+++ b/test/hope_kv_list_SUITE.erl
@@ -8,7 +8,8 @@
 
 %% Test cases
 -export(
-    [
+    [ t_set_new/1
+    , t_set_existing/1
     ]).
 
 
@@ -24,7 +25,8 @@ all() ->
 
 groups() ->
     Tests =
-        [
+        [ t_set_new
+        , t_set_existing
         ],
     Properties = [],
     [{?GROUP_KV_LIST, Properties, Tests}].
@@ -33,3 +35,20 @@ groups() ->
 %% =============================================================================
 %%  Test cases
 %% =============================================================================
+
+t_set_new(_Config) ->
+    Key           = key,
+    ValExpected   = bar,
+    ListInitial   = hope_kv_list:empty(),
+    ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected),
+    {some, ValResulting} = hope_kv_list:get(ListResulting, Key),
+    ValResulting = ValExpected.
+
+t_set_existing(_Config) ->
+    Key           = key,
+    ValInitial    = foo,
+    ValExpected   = bar,
+    ListInitial   = [{donald, duck}, {Key, ValInitial}],
+    ListResulting = hope_kv_list:set(ListInitial, Key, ValExpected),
+    {some, ValResulting} = hope_kv_list:get(ListResulting, Key),
+    ValResulting = ValExpected.