isEqual assertion returns false with two equal complex structures

Description

When comparing two equal, complex structures, the assertion sometimes returns false depending on how those structures get serialized.

By "complex" structure, I mean one with nested structures and arrays, i.e.

I believe the problem lies in the way in which TestBox is serializing the structures, i.e.

This will only create a predictable order of keys for the top level of keys - any nested structures and arrays are still native CFML structures.

Activity

Show:
Dominic Watson
January 15, 2014, 10:56 AM

The following reproduces the error for me. The key was creating a struct of type "linked" with StructNew( "linked" ):

Luis Majano
January 21, 2014, 1:42 AM

Dominic,

the "linked" portion is a railo only feature. so is the problem only with a linked hash map or with normal nested structs in adobe as well. I am not sure anymore on this ticket.

Adam Cameron
January 21, 2014, 7:18 AM

Repro:

Note the same value, different type. This is a meaningful difference in Java, but not in CFML.

Dominic Watson
January 21, 2014, 10:14 AM

The linked struct was the only way I could get a reproducable test case quickly. I don't think that really matter here though. The point is that the approach is trying to normalize the serialization of the structure but is only doing that at the top level. I recall also having problems when comparing an arguments scope with a structure in this way. I think a comparison that traverses the structure is unavoidable to prevent further oddities.

Dominic

Dominic Watson
January 30, 2014, 9:23 AM

Looking good

Fixed

Assignee

Luis Majano

Reporter

Dominic Watson

Labels

None

Components

Fix versions

Priority

Major
Configure