Skip to content

Commit 94a2762

Browse files
committed
test: fix tests for recent spark change
1 parent f56b334 commit 94a2762

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

config/config.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ if Mix.env() == :dev do
1515

1616
config :spark, :formatter, remove_parens?: true
1717
end
18+
19+
config :spark, :skip_diagnostic_warnings, true

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ defmodule Reactor.MixProject do
115115
# Run "mix help deps" to learn about dependencies.
116116
defp deps do
117117
[
118-
{:spark, "~> 2.0"},
118+
{:spark, "~> 2.3 and >= 2.3.3"},
119119
{:splode, "~> 0.2"},
120120
{:libgraph, "~> 0.16"},
121121
{:igniter, "~> 0.4", optional: true},

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"glob_ex": {:hex, :glob_ex, "0.1.11", "cb50d3f1ef53f6ca04d6252c7fde09fd7a1cf63387714fe96f340a1349e62c93", [:mix], [], "hexpm", "342729363056e3145e61766b416769984c329e4378f1d558b63e341020525de4"},
1616
"ham": {:hex, :ham, "0.3.2", "02ae195f49970ef667faf9d01bc454fb80909a83d6c775bcac724ca567aeb7b3", [:mix], [], "hexpm", "b71cc684c0e5a3d32b5f94b186770551509e93a9ae44ca1c1a313700f2f6a69a"},
1717
"hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"},
18-
"igniter": {:hex, :igniter, "0.6.28", "9db10192f19f10b924f14c805f5b2ad992617fccaff9cf9582b7f065d562d4d8", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:owl, "~> 0.11", [hex: :owl, repo: "hexpm", optional: false]}, {:phx_new, "~> 1.7", [hex: :phx_new, repo: "hexpm", optional: true]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "ad9369d626aeca21079ef17661a2672fb32598610c5e5bccae2537efd36b27d4"},
18+
"igniter": {:hex, :igniter, "0.6.29", "58ec46e601445df5ff3d98e65dce1305b10f23391d8f43558bc22bcbb3e1a7f0", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:owl, "~> 0.11", [hex: :owl, repo: "hexpm", optional: false]}, {:phx_new, "~> 1.7", [hex: :phx_new, repo: "hexpm", optional: true]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, ">= 1.1.1 and < 2.0.0-0", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "b45a5c70dcee77afd81a71c707fda7d0a8637061c60cdee639dc38d049443e02"},
1919
"iterex": {:hex, :iterex, "0.1.2", "58f9b9b9a22a55cbfc7b5234a9c9c63eaac26d276b3db80936c0e1c60355a5a6", [:mix], [], "hexpm", "2e103b8bcc81757a9af121f6dc0df312c9a17220f302b1193ef720460d03029d"},
2020
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
2121
"libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"},
@@ -34,7 +34,7 @@
3434
"rewrite": {:hex, :rewrite, "1.1.2", "f5a5d10f5fed1491a6ff48e078d4585882695962ccc9e6c779bae025d1f92eda", [:mix], [{:glob_ex, "~> 0.1", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0", [hex: :sourceror, repo: "hexpm", optional: false]}, {:text_diff, "~> 0.1", [hex: :text_diff, repo: "hexpm", optional: false]}], "hexpm", "7f8b94b1e3528d0a47b3e8b7bfeca559d2948a65fa7418a9ad7d7712703d39d4"},
3535
"sobelow": {:hex, :sobelow, "0.14.0", "dd82aae8f72503f924fe9dd97ffe4ca694d2f17ec463dcfd365987c9752af6ee", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "7ecf91e298acfd9b24f5d761f19e8f6e6ac585b9387fb6301023f1f2cd5eed5f"},
3636
"sourceror": {:hex, :sourceror, "1.10.0", "38397dedbbc286966ec48c7af13e228b171332be1ad731974438c77791945ce9", [:mix], [], "hexpm", "29dbdfc92e04569c9d8e6efdc422fc1d815f4bd0055dc7c51b8800fb75c4b3f1"},
37-
"spark": {:hex, :spark, "2.2.68", "4c4547c88d73311e3157bc402ab27f3a7bbd5e55a2ee92bcf7cd3a0a475d201e", [:mix], [{:igniter, ">= 0.3.64 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:sourceror, "~> 1.2", [hex: :sourceror, repo: "hexpm", optional: true]}], "hexpm", "2fa4dd89801415a098a421589633f0e3df7ed9ff4046e80a65d35a413bc0d194"},
37+
"spark": {:hex, :spark, "2.3.3", "b50863210ee926fa962a5841b35efdca2f6797e9a4b0980679d32b61acfa929f", [:mix], [{:igniter, ">= 0.3.64 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:sourceror, "~> 1.2", [hex: :sourceror, repo: "hexpm", optional: true]}], "hexpm", "5352003663590221bbcd0014b863a669b5f77eb5b9a3b3983be7b6de71ac6609"},
3838
"spitfire": {:hex, :spitfire, "0.2.1", "29e154873f05444669c7453d3d931820822cbca5170e88f0f8faa1de74a79b47", [:mix], [], "hexpm", "6eeed75054a38341b2e1814d41bb0a250564092358de2669fdb57ff88141d91b"},
3939
"splode": {:hex, :splode, "0.2.9", "3a2776e187c82f42f5226b33b1220ccbff74f4bcc523dd4039c804caaa3ffdc7", [:mix], [], "hexpm", "8002b00c6e24f8bd1bcced3fbaa5c33346048047bb7e13d2f3ad428babbd95c3"},
4040
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},

test/reactor/dsl/recurse_test.exs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,18 @@ defmodule Reactor.Dsl.RecurseTest do
150150
end
151151

152152
test "recurse fails when neither max_iterations nor exit_condition is provided" do
153-
assert_raise Spark.Error.DslError, ~r/Missing constraints for recursion/, fn ->
154-
defmodule InvalidRecurseReactor do
155-
use Reactor
156-
157-
recurse :invalid, FactorialReactor do
158-
argument :n, value(5)
159-
argument :acc, value(1)
153+
warning =
154+
ExUnit.CaptureIO.capture_io(:stderr, fn ->
155+
defmodule InvalidRecurseReactor do
156+
use Reactor
157+
158+
recurse :invalid, FactorialReactor do
159+
argument :n, value(5)
160+
argument :acc, value(1)
161+
end
160162
end
161-
end
162-
end
163+
end)
164+
165+
assert warning =~ "Missing constraints for recursion"
163166
end
164167
end

test/reactor/dsl/verifier_test.exs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
defmodule Reactor.Dsl.VerifierTest do
22
@moduledoc false
33
use ExUnit.Case, async: true
4+
import ExUnit.CaptureIO
45
alias Spark.Error.DslError
56

67
test "reactors cannot have duplicated step names" do
8+
# This is caught by the transformer, so still raises an error
79
assert_raise(DslError, ~r/duplicate steps/, fn ->
810
defmodule DuplicatedStepNameReactor do
911
@moduledoc false
@@ -16,20 +18,24 @@ defmodule Reactor.Dsl.VerifierTest do
1618
end
1719

1820
test "reactors cannot have recursively duplicated step names" do
19-
assert_raise(DslError, ~r/duplicate steps/, fn ->
20-
defmodule RecursivelyDuplicatedStepNameReactor do
21-
@moduledoc false
22-
use Reactor
21+
# This is caught by the verifier, so now produces a warning
22+
warning =
23+
capture_io(:stderr, fn ->
24+
defmodule RecursivelyDuplicatedStepNameReactor do
25+
@moduledoc false
26+
use Reactor
2327

24-
step :example, Example.Step.Greeter
28+
step :example, Example.Step.Greeter
2529

26-
group :group do
27-
before_all &{:ok, &1, &2, &3}
28-
after_all &{:ok, &1}
30+
group :group do
31+
before_all &{:ok, &1, &2, &3}
32+
after_all &{:ok, &1}
2933

30-
step :example, Example.Step.Greeter
34+
step :example, Example.Step.Greeter
35+
end
3136
end
32-
end
33-
end)
37+
end)
38+
39+
assert warning =~ "duplicate steps"
3440
end
3541
end

0 commit comments

Comments
 (0)