I am writing doc tests for the library for which I have to assert on the queries rather than the result. I came across an issue where i am asserting on the dynamics like this:
iex> result = {__MODULE__}.like_dynamic("name", "%Joh%", true, [dynamic_type: :and])
iex> inspect(result)
"dynamic([q], like(fragment("\(?)::TEXT\", q.name), ^"\%Joh%\") and ^true)"
It gives me this error:
Doctest did not compile, got: (TokenMissingError) lib/fat_ecto/query/dynamics.ex:480: missing terminator: ) (for "(" starting at line 480)
code: "dynamic([q], like(fragment("(?)::TEXT", q.name), ^"%Joh%") and ^true)"
I debugged it and figure out whenever there is a string inside the result doc test start failing, but if there is no string it works fine like this:
"dynamic([..., c], c.experience_years < ^2 and ^true)"
How to resolve this issue.
Any suggestions?
Thanks