Skip to content

Commit 703e862

Browse files
committed
Add remark in test on order
1 parent 172fd9f commit 703e862

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dsc/tests/dsc_functions.tests.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ Describe 'tests for function expressions' {
416416
@{ expression = "[lastIndexOf(createArray(createArray('a','b'), createArray('c','d'), createArray('a','b')), createArray('a','b'))]"; expected = 2 }
417417
@{ expression = "[lastIndexOf(createArray(createObject('name','John'), createObject('name','Jane'), createObject('name','John')), createObject('name','John'))]"; expected = 2 }
418418
@{ expression = "[lastIndexOf(createArray(), 'test')]"; expected = -1 }
419+
# Objects are compared by deep equality: same keys and values are equal, regardless of property order.
420+
# Both createObject('a',1,'b',2) and createObject('b',2,'a',1) are considered equal.
421+
# Therefore, lastIndexOf returns 1 (the last position where an equal object occurs).
419422
@{ expression = "[lastIndexOf(createArray(createObject('a',1,'b',2), createObject('b',2,'a',1)), createObject('a',1,'b',2))]"; expected = 1 }
420423
@{ expression = "[lastIndexOf(createArray('1','2','3'), 1)]"; expected = -1 }
421424
@{ expression = "[lastIndexOf(createArray(1,2,3), '1')]"; expected = -1 }

0 commit comments

Comments
 (0)