Flow Ecto like assertions in ExUnit

45 views
Skip to first unread message

Pedro Carvalho

unread,
Sep 4, 2022, 3:52:04 PM9/4/22
to elixir-lang-core
It would be nice if you could assert fields of structures in a piped ecto like style.

Ex:
my_struct
|> assert_not_nil([:some_field,:other_field]
|> assert_exists([:another_field])
|> do_something()
|> assert_expression([new_struct],  new_struct.another_field != my_struct.another_field  )

Ben Wilson

unread,
Sep 5, 2022, 3:02:43 AM9/5/22
to elixir-lang-core
Seems like a good opportunity for a library. There's not anything I'm seeing there that would require changes to the core language. Building a library is a good way to test out if it's a popular idea and work though any of the design challenges.
Reply all
Reply to author
Forward
0 new messages