Elixir 1.2 support
mgwidmann opened this issue · comments
When upgrading to Elixir 1.2, because of the new with
keyword, the following compile error is thrown:
** (CompileError) test/github/watcher_test.exs:2: cannot import Pavlov.Mocks.Matchers.with/2 because it conflicts with Elixir special forms
(elixir) src/elixir_import.erl:92: :elixir_import.calculate/6
(elixir) src/elixir_import.erl:22: :elixir_import.import/4
expanding macro: Pavlov.Mocks.__using__/1
test/github/watcher_test.exs:2: SlackCoder.Github.WatcherTest (module)
(elixir) expanding macro: Kernel.use/1
test/github/watcher_test.exs:2: SlackCoder.Github.WatcherTest (module)
expanding macro: Pavlov.Case.__using__/1
test/github/watcher_test.exs:2: SlackCoder.Github.WatcherTest (module)
(elixir) expanding macro: Kernel.use/2
test/github/watcher_test.exs:2: SlackCoder.Github.WatcherTest (module)
(elixir) lib/code.ex:363: Code.require_file/2
(elixir) lib/kernel/parallel_require.ex:47: anonymous fn/2 in Kernel.ParallelRequire.spawn_requires/5
Putting import Kernel, except: [with: 1]
before use Pavlov.Case
does not seem to remedy the issue...
Additionally, all examples like
expect "This" |> to_eq "That"
Produce compiler warnings now like:
warning: you are piping into a function call without parentheses, which may be ambiguous. Please wrap the function you are piping into in parentheses. For example:
foo 1 |> bar 2 |> baz 3
Should be written as:
foo(1) |> bar(2) |> baz(3)
I think this is the biggest problem since the entire DSL depends upon this ambiguity. Writing the above as expect("This") |> to_eq("That")
doesn't work, the DSL wants instead expect("This" |> to_eq("That"))
which may be non-obvious to users.
For this reason it looks like the entire DSL needs an overhaul 😞
Yeah, you're right about the DSL needing an overhaul... 😞.
I'll try to look into it and see if I can make it work with parenthesis everywhere. Do you have any alternative ideas we could explore that would lead to a better DSL?
I would look to see if the code can be reworked internally to support the parens version as thats the simplest solution.
#49 will get elixir 1.2 at least compiling, but is not backwards compatible so you may want to bump to 0.3.0
when releasing it.
Yes, I think I can make it work with the parens syntax. After that is solved I'll release 0.3.0 with both fixes 😄.