aboutsummaryrefslogtreecommitdiffstats
path: root/docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-29 18:37:26 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-10-31 21:03:06 +0000
commit2f3654275e44f9719818a848da9a0b576d5a1b53 (patch)
treeff75764bbb2e3037f73f95a96ac5ed2fcba93465 /docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
parent2a7b4defe300dfe5eb19f775bd819e2d300b7453 (diff)
Docs reorganization and update
Docs reorganization and update using the latest afb-test improvments and try to make it clearer. Change-Id: If022cdb46364ef250361bdcd420d45b360f10a2e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md')
-rw-r--r--docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md b/docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
new file mode 100644
index 0000000..8d29988
--- /dev/null
+++ b/docs/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