Skip to content

ExUnit assert diff coloring false positive on non byte aligned binaries #15204

@hissssst

Description

@hissssst

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.2.7.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.19.5 (compiled with Erlang/OTP 27)

But I suspect it is present in master too

Operating system

linux

Current behavior

mix run the .exs file below

ExUnit.start()

defmodule Test do
  use ExUnit.Case

  test "_" do
    assert [<<1 :: size(1)>>, :x, 1] == [<<1 :: size(1)>>, :x]
  end
end

You will get an output which looks like this (but it is colored)

  1) test _ (Test)
     x.exs:6
     Assertion with == failed
     code:  assert [<<1::size(1)>>, :x, 1] == [<<1::size(1)>>, :x]
     left:  [<<1::size(1)>>, :x, 1]
     right: [<<1::size(1)>>, :x]
     stacktrace:
       x.exs:7: (test)

You can see that it colors <<1 :: size(1)>> as a thing which is different in both sides, while it is not.

Expected behavior

Only the last item of the output is colored red.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions