zachallaun/mneme

Crash when doing substring diffing in sigils

tcoopman opened this issue · 3 comments

I'm not sure yet what I did what caused this...


  1) test event based progress updated (DomainModelling.ExerciseEventsTest)
     test/domain_modelling/exercise_events_test.exs:169
     ** (Mneme.InternalError) Mneme encountered an internal error. This is likely a bug in Mneme.

     Please consider reporting this error at https://github.com/zachallaun/mneme/issues. Thanks!

     ** (MatchError) no match of right hand side value: %{__depth__: 6, __hash__: 75581201, __id__: {4, 75581201}, __n_descendants__: 0, column: 32, line: 3}
         (mneme 0.4.0) lib/mneme/diff/formatter.ex:261: Mneme.Diff.Formatter.edit_script_to_fmt_instructions/3
         (elixir 1.15.2) lib/enum.ex:4317: Enum.flat_map_list/2
         (mneme 0.4.0) lib/mneme/diff/formatter.ex:93: Mneme.Diff.Formatter.to_fmt_instructions/1
         (mneme 0.4.0) lib/mneme/diff/formatter.ex:25: Mneme.Diff.Formatter.highlight_lines/2
         (mneme 0.4.0) lib/mneme/diff.ex:66: Mneme.Diff.format/2
         (elixir 1.15.2) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
         (elixir 1.15.2) lib/task/supervised.ex:36: Task.Supervised.reply/4


     code: auto_assert [
     stacktrace:
       (mneme 0.4.0) lib/mneme/assertion.ex:159: Mneme.Assertion.handle_assertion/4
       (mneme 0.4.0) lib/mneme/assertion.ex:121: Mneme.Assertion.do_run/3
       (mneme 0.4.0) lib/mneme/assertion.ex:102: Mneme.Assertion.run/3
       test/domain_modelling/exercise_events_test.exs:176: (test)

I'll see if I can find out. This was a test that used to work and now it doesn't anymore

A minimal reproduction:

    test "foo" do
      a = ~U[2023-10-25 14:15:39.656480Z]
      auto_assert ~U[2024-10-25 14:15:39.656480Z] <- a
    end

Notice that the change in year.

Thanks for the reproduction! Fixed in 0.4.1 🙂

Thanks for fixing it so quickly :)