aboutsummaryrefslogtreecommitdiffstats
path: root/docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
diff options
context:
space:
mode:
authorCorentin Le Gall <corentinlgs@gmail.com>2018-07-19 15:57:30 +0200
committerCorentin Le Gall <corentinlgs@gmail.com>2018-07-24 14:42:12 +0200
commitc96df58a88b60c7501b3c8a758c0277c17088371 (patch)
tree1e982c565a4fd0ba65a382cc1cba97efe891c34b /docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
parent55673d50338f041763e6e38f38ea3fc311f2bdc1 (diff)
Changed doc to GitBook format + added doc
-Changed README.md to a complet GitBook doc. -Added explanations about EvtGrpReceived functions. -Corrected mistakes + reduced lines length. Change-Id: I1a077ddf6acb520a9158de658d3c09b12a2029d4 Signed-off-by: Corentin Le Gall <corentinlgs@gmail.com>
Diffstat (limited to 'docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md')
-rw-r--r--docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md b/docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
new file mode 100644
index 0000000..8d29988
--- /dev/null
+++ b/docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
@@ -0,0 +1,19 @@
+# Table assertions
+
+* **_AFT.assertItemsEquals(actual, expected)**
+
+ Assert that two tables contain the same items, irrespective of their keys.
+
+ This function is practical for example if you want to compare two lists but
+ where items are not in the same order:
+
+ ```lua
+ luaunit.assertItemsEquals( {1,2,3}, {3,2,1} ) -- assertion succeeds
+ ```
+ The comparison is not recursive on the items: if any of the items are tables,
+ they are compared using table equality (like as in assertEquals() ), where the
+ key matters.
+
+ ```lua
+ luaunit.assertItemsEquals( {1,{2,3},4}, {4,{3,2,},1} ) -- assertion fails because {2,3} ~= {3,2}
+ ``` \ No newline at end of file