summaryrefslogtreecommitdiffstats
path: root/docs/WriteYourTests/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md
diff options
context:
space:
mode:
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