From 2f3654275e44f9719818a848da9a0b576d5a1b53 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 29 Oct 2018 18:37:26 +0100 Subject: 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 --- .../LuaUnitAssertionFunctions/6_TableAssertions.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md (limited to 'docs/Reference/LuaUnitAssertionFunctions/6_TableAssertions.md') 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 -- cgit 1.2.3-korg