Should-BeEquivalent has a -StrictOrder switch that does not work. The parameter declaration is commented out in the param block, but the body still branches on $StrictOrder in two places (the array comparison and the DataTable comparison), so $StrictOrder is always unbound and both branches are dead. There is even a test that only passes because passing -StrictOrder throws a parameter binding error.
Remove it:
- drop the commented
# [Switch] $StrictOrder declaration,
- remove the two dead
if ($StrictOrder) branches and keep the order insensitive path,
- remove the test that asserts
-StrictOrder throws.
Found while auditing the new Should-* assertions for consistency, see #2874.
🤖
Should-BeEquivalenthas a-StrictOrderswitch that does not work. The parameter declaration is commented out in theparamblock, but the body still branches on$StrictOrderin two places (the array comparison and theDataTablecomparison), so$StrictOrderis always unbound and both branches are dead. There is even a test that only passes because passing-StrictOrderthrows a parameter binding error.Remove it:
# [Switch] $StrictOrderdeclaration,if ($StrictOrder)branches and keep the order insensitive path,-StrictOrderthrows.Found while auditing the new
Should-*assertions for consistency, see #2874.🤖