Skip to content
This repository has been archived by the owner on Nov 19, 2023. It is now read-only.

Does not work with nil tuples #32

Closed
sobolevn opened this issue Mar 15, 2019 · 1 comment · Fixed by #33
Closed

Does not work with nil tuples #32

sobolevn opened this issue Mar 15, 2019 · 1 comment · Fixed by #33

Comments

@sobolevn
Copy link
Contributor

I have this very simple test case:

Code

defmodule KiraTest.ExampleTest do
  use ExUnit.Case
  use ExUnit.Parameterized

  describe "nil example" do
    test_with_params "should be working, but does not work",
    fn (first, second) ->
      assert first == second
    end do
      [
        {1, 1},
        {2, 2}
      ]
    end
  end
end

And it works fine.

Now, let's add one more case {nil, nil}:

defmodule KiraTest.ExampleTest do
  use ExUnit.Case
  use ExUnit.Parameterized

  describe "nil example" do
    test_with_params "should be working, but does not work",
    fn (first, second) ->
      assert first == second
    end do
      [
        {1, 1},
        {2, 2},
        {nil, nil}
      ]
    end
  end
end

Output

» mix test

== Compilation error in file test/kira/usecases/example_test.exs ==
** (ArgumentError) argument error
    :erlang.tuple_to_list(nil)
    (ex_parameterized) lib/ex_parameterized/params.ex:92: ExUnit.Parameterized.Params.escape_values/1
    (ex_parameterized) lib/ex_parameterized/params.ex:58: ExUnit.Parameterized.Params.test_with/3
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
    (ex_parameterized) expanding macro: ExUnit.Parameterized.Params.test_with_params/3
    test/kira/usecases/example_test.exs:6: KiraTest.ExampleTest (module)
    (ex_unit) expanding macro: ExUnit.Case.describe/2
    test/kira/usecases/example_test.exs:5: KiraTest.ExampleTest (module)
    (elixir) lib/code.ex:767: Code.require_file/2
    (elixir) lib/kernel/parallel_compiler.ex:211: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

Version information

I am using:

» mix --version
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1][hipe] [dtrace]

Mix 1.8.1 (compiled with Erlang/OTP 21)

And {:ex_parameterized, "~> 1.3.5", only: :test},

@KazuCocoa
Copy link
Owner

I've published https://hex.pm/packages/ex_parameterized/1.3.6
Could you get the latest one? @sobolevn

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants