www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4493] New: std.json unittest is broken

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4493

           Summary: std.json unittest is broken
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: kroeplin.d googlemail.com


--- Comment #0 from Mario Kroeplin <kroeplin.d googlemail.com> 2010-07-22
13:43:13 PDT ---
Created an attachment (id=694)
replacement for unittest of std.json

The only non-trivial unittest is commented out as "currently broken".
This is confusing: in fact, not the implementation but only the unittest is
broken.
The reason is, that the order of the name/value pairs in a JSON object is
unspecified:
the serialization uses foreach(name, member; value.object)!

The example just before the "currently broken" one is {"a":1,"b":null}:
as the result could also be {"b":null,"a":1}, this test is broken in theory,
but not (yet) in practice.

Please, consider to replace the broken unittest with the attached proposal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4493



--- Comment #1 from Mario Kroeplin <kroeplin.d googlemail.com> 2010-07-26
12:15:41 PDT ---
assert(find(json, result) != null, text(result, " should be in ", json));
should have been
    assert(!find(json, result).empty, text(result, " should be in ", json));

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 26 2010