CollectionTest.testSortEmptyArray fails

6 views
Skip to first unread message

Chris Blackwell

unread,
Jan 20, 2012, 5:33:34 AM1/20/12
to ColdSpring-Users
Not sure if this is a recent change in mxunit, but
unittests.util.CollectionTest.testSortEmptyArray fails with the
message

from Assert.cfc@416
"Cannot compare array references in ColdFusion
Arrays in ColdFusion are passed by value. To compare instances, you
may wrap the array in a struct and compare those."

Doing as suggested and wrapping the arrays in a struct allows the test
to pass.


diff --git a/unittests/util/CollectionTest.cfc b/unittests/util/
CollectionTest.cfc
index 5046952..342070a 100644
--- a/unittests/util/CollectionTest.cfc
+++ b/unittests/util/CollectionTest.cfc
@@ -209,8 +209,8 @@

assertTrue(arrayIsEmpty(local.sorted.getCollection()));

- assertNotSame(local.collection, local.sorted);
- assertNotSame(local.collection.getCollection(),
local.sorted.getCollection());
+ assertNotSame({value=local.collection}, {value=local.sorted});
+ assertNotSame({value=local.collection.getCollection()},
{value=local.sorted.getCollection()});
</cfscript>
</cffunction>


I ran the tests on railo-express 3.3.1.010, but this doesn't appear to
be engine specific

Cheers, Chris

Mark Mandel

unread,
Jan 20, 2012, 6:02:29 AM1/20/12
to coldspri...@googlegroups.com
Actually, thanks for reminding me - I have to set up a pull request to mxunit to get rid of that restriction.

I have it locally (hence my tests passing).

Mark


--
You received this message because you are subscribed to the Google Groups "ColdSpring-Users" group.
To post to this group, send email to coldspri...@googlegroups.com.
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldspring-users?hl=en.




--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

2 Devs from Down Under Podcast

Chris Blackwell

unread,
Jan 20, 2012, 6:19:46 AM1/20/12
to ColdSpring-Users
Just out of curiosity, what've you changed in mxunit to allow this?
array's are still passed by value right?
> E: mark.man...@gmail.com

Mark Mandel

unread,
Jan 20, 2012, 6:24:09 AM1/20/12
to coldspri...@googlegroups.com
Not if they are native Java ArrayLists, like I'm using in the test :)

There is my pull request on MXUnit.

Mark
Reply all
Reply to author
Forward
0 new messages