Re: [elixir-core:11364] Format inspect output as valid elixir

2023-05-09 Thread José Valim
There is a "structs: false" option but I am not sure if that is supported
when diffing.

But also keep in mind there are structures that represent memory data (such
as PIDs and REFs) and those can never really be copy and pasted. And
sometimes, like above, it shows in a special style because it is private
and you are not supposed to assert on it (i.e. you should remove it).

On Tue, May 9, 2023 at 5:42 PM Adam Kirk  wrote:

> I do this ALL the time, but heres a specific example: When I write a test,
> I do something like
>
> assert [] = Repo.all(Thing)
>
> it fails, I copy what the match shows into my test and modify it to what I
> need.
>
> except that it outputs stuff like:
>
> ```
> __meta__: #Ecto.Schema.Metadata<:loaded, "thing">
> ```
> which isn't valid elixir, so I can't run mix format to make it nice before
> I modify it.
>
> This applies to a ton of workflows I have. I'm curious why it can't be
> output as valid elixir instead of this special formatting with special
> characters like `#` etc
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/3648f1d0-73a0-47a5-ac83-6bec7c933290n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KVMoOB1zKd8H6FNBzMa6mW%2BNs2vPpYkneSFDiVh6ez8Q%40mail.gmail.com.


[elixir-core:11364] Format inspect output as valid elixir

2023-05-09 Thread Adam Kirk
I do this ALL the time, but heres a specific example: When I write a test, 
I do something like 

assert [] = Repo.all(Thing)

it fails, I copy what the match shows into my test and modify it to what I 
need.  

except that it outputs stuff like:

```
__meta__: #Ecto.Schema.Metadata<:loaded, "thing">
```
which isn't valid elixir, so I can't run mix format to make it nice before 
I modify it.

This applies to a ton of workflows I have. I'm curious why it can't be 
output as valid elixir instead of this special formatting with special 
characters like `#` etc

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/3648f1d0-73a0-47a5-ac83-6bec7c933290n%40googlegroups.com.