Johan Bolmsjö ad77e93415 std.testing.expectEqual: show differing pointer values
Show differing pointer values when comparing pointers instead of the
content they point to.

It's confusing for a test to say "expected S{.x = 1}, found S{.x = 1}"
as illustrated below when it was the pointers that differed.

There seems to be different rules for when a pointer is dereferenced by
the printing routine depending on its type. I don't fully grok this but
it's also illustrated below.

    const std = @import("std");

    const S = struct { x: u32 };

    // before: ...expected S{ .x = 1 }, found S{ .x = 1 }
    // after:  ...expected S@7ffcd20b7798, found S@7ffcd20b7790
    test "compare_ptr_to_struct" {
        var a = S{.x = 1};
        var b = S{.x = 1};
        std.testing.expectEqual(&a, &b);
    }

    // before: ...expected u32@7fff316ba31c, found u32@7fff316ba318
    // after:  ...expected u32@7ffecec622dc, found u32@7ffecec622d8
    test "compare_ptr_to_scalar" {
        var a: u32 = 1;
        var b: u32 = 1;
        std.testing.expectEqual(&a, &b);
    }
2019-11-19 06:22:34 +00:00
..
2019-11-13 00:52:15 +02:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:25 -05:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:25 -05:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2019-11-08 01:52:23 -05:00
2019-09-25 23:35:41 -04:00
2019-11-01 22:42:25 -04:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-10-11 18:13:24 -04:00
2019-11-08 15:57:25 -05:00
2019-09-25 23:35:41 -04:00
2019-11-12 17:55:54 +02:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:25 -05:00
2019-11-12 17:55:54 +02:00
2019-11-08 01:52:23 -05:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:25 -05:00
2019-09-25 23:35:41 -04:00
2019-11-08 15:57:24 -05:00
2019-11-13 00:52:15 +02:00
2019-11-08 15:57:24 -05:00
2019-11-08 15:57:24 -05:00
2019-09-25 23:35:41 -04:00