diff --git a/lib/elixir/lib/calendar/iso.ex b/lib/elixir/lib/calendar/iso.ex index d4f2d5b9903..c7a60b473f6 100644 --- a/lib/elixir/lib/calendar/iso.ex +++ b/lib/elixir/lib/calendar/iso.ex @@ -74,16 +74,15 @@ defmodule Calendar.ISO do {2000, 1, 1, 12, 0, 0, {0, 6}} """ - @spec naive_datetime_from_iso_days(Calendar.iso_days()) :: - { - Calendar.year(), - Calendar.month(), - Calendar.day(), - Calendar.hour(), - Calendar.minute(), - Calendar.second(), - Calendar.microsecond() - } + @spec naive_datetime_from_iso_days(Calendar.iso_days()) :: { + Calendar.year(), + Calendar.month(), + Calendar.day(), + Calendar.hour(), + Calendar.minute(), + Calendar.second(), + Calendar.microsecond() + } @impl true def naive_datetime_from_iso_days({days, day_fraction}) do {year, month, day} = date_from_iso_days(days) diff --git a/lib/elixir/lib/code.ex b/lib/elixir/lib/code.ex index 4a88852e413..ac8ee6e0016 100644 --- a/lib/elixir/lib/code.ex +++ b/lib/elixir/lib/code.ex @@ -379,10 +379,9 @@ defmodule Code do arg2, arg3 - If the last argument is a data structure of variable length, such as - maps and lists, and the beginning of the data structure fits on the - same line as the function call, then no indentation happens, this - allows code like this: + If the last argument is a data structure, such as maps and lists, and + the beginning of the data structure fits on the same line as the function + call, then no indentation happens, this allows code like this: Enum.reduce(some_collection, initial_value, fn element, acc -> # code diff --git a/lib/elixir/lib/code/formatter.ex b/lib/elixir/lib/code/formatter.ex index bf5b189a7a8..696d17e1caf 100644 --- a/lib/elixir/lib/code/formatter.ex +++ b/lib/elixir/lib/code/formatter.ex @@ -415,11 +415,11 @@ defmodule Code.Formatter do # {} # {1, 2} defp quoted_to_algebra({:{}, meta, args}, _context, state) do - tuple_to_algebra(meta, args, state) + tuple_to_algebra(meta, args, :flex_glue, state) end defp quoted_to_algebra({:__block__, meta, [{left, right}]}, _context, state) do - tuple_to_algebra(meta, [left, right], state) + tuple_to_algebra(meta, [left, right], :flex_glue, state) end defp quoted_to_algebra({:__block__, meta, [list]}, _context, state) when is_list(list) do @@ -558,7 +558,7 @@ defmodule Code.Formatter do end doc = - with_next_break_fits(next_break_fits?(right_arg), right, fn right -> + with_next_break_fits(next_break_fits?(right_arg, state), right, fn right -> concat(group(left), group(nest(glue(op, group(right)), 2, :break))) end) @@ -727,7 +727,7 @@ defmodule Code.Formatter do true -> next_break_fits? = - op in @next_break_fits_operators and next_break_fits?(right_arg) and + op in @next_break_fits_operators and next_break_fits?(right_arg, state) and not Keyword.get(meta, :eol, false) with_next_break_fits(next_break_fits?, right, fn right -> @@ -887,7 +887,7 @@ defmodule Code.Formatter do # expression.{arguments} defp remote_to_algebra({{:., _, [target, :{}]}, meta, args}, _context, state) do {target_doc, state} = remote_target_to_algebra(target, state) - {call_doc, state} = tuple_to_algebra(meta, args, state) + {call_doc, state} = tuple_to_algebra(meta, args, :glue, state) {concat(concat(target_doc, "."), call_doc), state} end @@ -1008,8 +1008,8 @@ defmodule Code.Formatter do # * :required - never skip parens # defp call_args_to_algebra([], meta, _context, _parens, _list_to_keyword?, state) do - {args_doc, state} = - args_to_algebra_with_comments([], meta, false, false, false, state, &{&1, &2}) + {args_doc, _join, state} = + args_to_algebra_with_comments([], meta, false, false, :glue, state, &{&1, &2}) {{surround("(", args_doc, ")"), state}, false} end @@ -1056,19 +1056,19 @@ defmodule Code.Formatter do if left != [] and keyword? and skip_parens? and generators_count == 0 do call_args_to_algebra_with_no_parens_keywords(meta, left, right, context, extra, state) else - next_break_fits? = next_break_fits?(right) + next_break_fits? = next_break_fits?(right, state) force_keyword? = keyword? and force_keyword?(right) non_empty_eol? = left != [] and not next_break_fits? and Keyword.get(meta, :eol, false) - force_unfit? = generators_count > 1 or force_keyword? or non_empty_eol? + join = if generators_count > 1 or force_keyword? or non_empty_eol?, do: :line, else: :glue args = if keyword?, do: left ++ right, else: left ++ [right] - {args_doc, state} = + {args_doc, _join, state} = args_to_algebra_with_comments( args, meta, skip_parens?, next_break_fits?, - force_unfit?, + join, state, "ed_to_algebra(&1, context, &2) ) @@ -1098,11 +1098,11 @@ defmodule Code.Formatter do defp call_args_to_algebra_with_no_parens_keywords(meta, left, right, context, extra, state) do to_algebra_fun = "ed_to_algebra(&1, context, &2) - {left_doc, state} = - args_to_algebra_with_comments(left, meta, true, false, false, state, to_algebra_fun) + {left_doc, _join, state} = + args_to_algebra_with_comments(left, meta, true, false, :glue, state, to_algebra_fun) - {right_doc, state} = - args_to_algebra_with_comments(right, meta, false, false, false, state, to_algebra_fun) + {right_doc, _join, state} = + args_to_algebra_with_comments(right, meta, false, false, :glue, state, to_algebra_fun) right_doc = "," |> glue(right_doc) |> force_keyword(right) |> group(:inherit) @@ -1241,15 +1241,19 @@ defmodule Code.Formatter do defp bitstring_to_algebra(meta, args, state) do last = length(args) - 1 + join = if Keyword.get(meta, :eol, false), do: :line, else: :flex_glue to_algebra_fun = &bitstring_segment_to_algebra(&1, &2, last) - force_unfit? = Keyword.get(meta, :eol, false) - {args_doc, state} = + {args_doc, join, state} = args |> Enum.with_index() - |> args_to_algebra_with_comments(meta, false, false, force_unfit?, state, to_algebra_fun) + |> args_to_algebra_with_comments(meta, false, false, join, state, to_algebra_fun) - {surround("<<", args_doc, ">>"), state} + if join == :flex_glue do + {"<<" |> concat(args_doc) |> nest(2) |> concat(">>") |> group(), state} + else + {surround("<<", args_doc, ">>"), state} + end end defp bitstring_segment_to_algebra({{:<-, meta, [left, right]}, i}, state, last) do @@ -1298,22 +1302,22 @@ defmodule Code.Formatter do ## Literals defp list_to_algebra(meta, args, state) do - to_algebra_fun = "ed_to_algebra(&1, :parens_arg, &2) - force_unfit? = Keyword.get(meta, :eol, false) + join = if Keyword.get(meta, :eol, false), do: :line, else: :glue + fun = "ed_to_algebra(&1, :parens_arg, &2) - {args_doc, state} = - args_to_algebra_with_comments(args, meta, false, false, force_unfit?, state, to_algebra_fun) + {args_doc, _join, state} = + args_to_algebra_with_comments(args, meta, false, false, join, state, fun) {surround("[", args_doc, "]"), state} end defp map_to_algebra(meta, name_doc, [{:|, _, [left, right]}], state) do + join = if Keyword.get(meta, :eol, false), do: :line, else: :glue fun = "ed_to_algebra(&1, :parens_arg, &2) - force_unfit? = Keyword.get(meta, :eol, false) {left_doc, state} = fun.(left, state) - {right_doc, state} = - args_to_algebra_with_comments(right, meta, false, false, force_unfit?, state, fun) + {right_doc, _join, state} = + args_to_algebra_with_comments(right, meta, false, false, join, state, fun) args_doc = left_doc @@ -1325,33 +1329,27 @@ defmodule Code.Formatter do end defp map_to_algebra(meta, name_doc, args, state) do - force_unfit? = Keyword.get(meta, :eol, false) + join = if Keyword.get(meta, :eol, false), do: :line, else: :glue fun = "ed_to_algebra(&1, :parens_arg, &2) - {args_doc, state} = - args_to_algebra_with_comments(args, meta, false, false, force_unfit?, state, fun) + {args_doc, _join, state} = + args_to_algebra_with_comments(args, meta, false, false, join, state, fun) name_doc = "%" |> concat(name_doc) |> concat("{") {surround(name_doc, args_doc, "}"), state} end - defp tuple_to_algebra(meta, args, state) do - force_unfit? = Keyword.get(meta, :eol, false) + defp tuple_to_algebra(meta, args, join, state) do + join = if Keyword.get(meta, :eol, false), do: :line, else: join fun = "ed_to_algebra(&1, :parens_arg, &2) - next_break_fits? = - args != [] and next_break_fits?(Enum.fetch!(args, -1)) and - not Keyword.get(meta, :eol, false) - - {args_doc, state} = - args_to_algebra_with_comments(args, meta, false, next_break_fits?, force_unfit?, state, fun) - - doc = surround("{", args_doc, "}") + {args_doc, join, state} = + args_to_algebra_with_comments(args, meta, false, false, join, state, fun) - if next_break_fits? do - {next_break_fits(doc, :disabled), state} + if join == :flex_glue do + {"{" |> concat(args_doc) |> nest(1) |> concat("}") |> group(), state} else - {doc, state} + {surround("{", args_doc, "}"), state} end end @@ -1456,15 +1454,7 @@ defmodule Code.Formatter do defp heredoc_line(["", _ | _]), do: nest(line(), :reset) defp heredoc_line(_), do: line() - defp args_to_algebra_with_comments( - args, - meta, - skip_parens?, - next_break_fits?, - force_unfit?, - state, - fun - ) do + defp args_to_algebra_with_comments(args, meta, skip_parens?, next_break_fits?, join, state, fun) do min_line = line(meta) max_line = end_line(meta) @@ -1498,13 +1488,16 @@ defmodule Code.Formatter do cond do args_docs == [] -> - {@empty, state} + {@empty, :empty, state} - force_unfit? or comments? -> - {args_docs |> Enum.reduce(&line(&2, &1)) |> force_unfit(), state} + join == :line or comments? -> + {args_docs |> Enum.reduce(&line(&2, &1)) |> force_unfit(), :line, state} - true -> - {args_docs |> Enum.reduce(&glue(&2, &1)), state} + join == :glue -> + {args_docs |> Enum.reduce(&glue(&2, &1)), :glue, state} + + join == :flex_glue -> + {args_docs |> Enum.reduce(&flex_glue(&2, &1)), :flex_glue, state} end end @@ -1674,7 +1667,11 @@ defmodule Code.Formatter do defp clause_args_to_algebra(args, min_line, state) do meta = [line: min_line] fun = &clause_args_to_algebra/2 - args_to_algebra_with_comments([args], meta, false, false, false, state, fun) + + {args_docs, _join, state} = + args_to_algebra_with_comments([args], meta, false, false, :glue, state, fun) + + {args_docs, state} end # fn a, b, c when d -> e end @@ -1916,43 +1913,61 @@ defmodule Code.Formatter do end end - defp next_break_fits?({:<<>>, meta, [_ | _] = entries}) do - meta[:format] == :bin_heredoc or not interpolated?(entries) + defp next_break_fits?({:{}, meta, _args}, state) do + eol_or_comments?(meta, state) + end + + defp next_break_fits?({:__block__, meta, [{_, _}]}, state) do + eol_or_comments?(meta, state) end - defp next_break_fits?({{:., _, [String, :to_charlist]}, _, [{:<<>>, meta, [_ | _]}]}) do + defp next_break_fits?({:<<>>, meta, [_ | _] = entries}, state) do + meta[:format] == :bin_heredoc or + (not interpolated?(entries) and eol_or_comments?(meta, state)) + end + + defp next_break_fits?({{:., _, [String, :to_charlist]}, _, [{:<<>>, meta, [_ | _]}]}, _state) do meta[:format] == :list_heredoc end - defp next_break_fits?({{:., _, [_left, :{}]}, _, _}) do + defp next_break_fits?({{:., _, [_left, :{}]}, _, _}, _state) do true end - defp next_break_fits?({:__block__, meta, [string]}) when is_binary(string) do + defp next_break_fits?({:__block__, meta, [string]}, _state) when is_binary(string) do meta[:format] == :bin_heredoc end - defp next_break_fits?({:__block__, meta, [list]}) when is_list(list) do + defp next_break_fits?({:__block__, meta, [list]}, _state) when is_list(list) do meta[:format] != :charlist end - defp next_break_fits?({form, _, [_ | _]}) when form in [:fn, :%{}, :%] do + defp next_break_fits?({form, _, [_ | _]}, _state) when form in [:fn, :%{}, :%] do true end - defp next_break_fits?({fun, meta, args}) when is_atom(fun) and is_list(args) do + defp next_break_fits?({fun, meta, args}, _state) when is_atom(fun) and is_list(args) do meta[:terminator] in [@double_heredoc, @single_heredoc] and fun |> Atom.to_string() |> String.starts_with?("sigil_") end - defp next_break_fits?({{:__block__, _, [atom]}, expr}) when is_atom(atom) do - next_break_fits?(expr) + defp next_break_fits?({{:__block__, _, [atom]}, expr}, state) when is_atom(atom) do + next_break_fits?(expr, state) end - defp next_break_fits?(_) do + defp next_break_fits?(_, _state) do false end + defp eol_or_comments?(meta, %{comments: comments}) do + Keyword.get(meta, :eol, false) or + ( + min_line = line(meta) + max_line = end_line(meta) + Enum.any?(comments, fn {line, _, _} -> line > min_line and line < max_line end) + ) + end + defp last_arg_to_keyword([_ | _] = arg, _list_to_keyword?) do {keyword?(arg), arg} end diff --git a/lib/elixir/lib/dynamic_supervisor.ex b/lib/elixir/lib/dynamic_supervisor.ex index 02dd6bb7f34..1803bd3e265 100644 --- a/lib/elixir/lib/dynamic_supervisor.ex +++ b/lib/elixir/lib/dynamic_supervisor.ex @@ -440,14 +440,15 @@ defmodule DynamicSupervisor do :ok <- validate_seconds(max_seconds), :ok <- validate_dynamic(max_children), :ok <- validate_extra_arguments(extra_arguments) do - {:ok, %{ - state - | extra_arguments: extra_arguments, - max_children: max_children, - max_restarts: max_restarts, - max_seconds: max_seconds, - strategy: strategy - }} + {:ok, + %{ + state + | extra_arguments: extra_arguments, + max_children: max_children, + max_restarts: max_restarts, + max_seconds: max_seconds, + strategy: strategy + }} end end diff --git a/lib/elixir/lib/kernel.ex b/lib/elixir/lib/kernel.ex index efacda7d41f..725c246f719 100644 --- a/lib/elixir/lib/kernel.ex +++ b/lib/elixir/lib/kernel.ex @@ -3134,10 +3134,11 @@ defmodule Kernel do fun = fn {x, pos}, acc -> case x do {op, _, [_]} when op == :+ or op == :- -> - :elixir_errors.warn(__CALLER__.line, __CALLER__.file, << - "piping into a unary operator is deprecated, please use the ", - "qualified name. For example, Kernel.+(5), instead of +5" - >>) + message = + <<"piping into a unary operator is deprecated, please use the ", + "qualified name. For example, Kernel.+(5), instead of +5">> + + :elixir_errors.warn(__CALLER__.line, __CALLER__.file, message) _ -> :ok diff --git a/lib/elixir/lib/kernel/typespec.ex b/lib/elixir/lib/kernel/typespec.ex index 816f9f44289..f57992aaf09 100644 --- a/lib/elixir/lib/kernel/typespec.ex +++ b/lib/elixir/lib/kernel/typespec.ex @@ -751,13 +751,11 @@ defmodule Kernel.Typespec do typespec_to_ast({:type, line, :charlist, []}) end - defp typespec_to_ast( - { - :remote_type, - line, - [{:atom, _, :elixir}, {:atom, _, :nonempty_charlist}, []] - } - ) do + defp typespec_to_ast({ + :remote_type, + line, + [{:atom, _, :elixir}, {:atom, _, :nonempty_charlist}, []] + }) do typespec_to_ast({:type, line, :nonempty_charlist, []}) end diff --git a/lib/elixir/test/elixir/code_formatter/calls_test.exs b/lib/elixir/test/elixir/code_formatter/calls_test.exs index 1b6df055ecb..6b8ce15e6d9 100644 --- a/lib/elixir/test/elixir/code_formatter/calls_test.exs +++ b/lib/elixir/test/elixir/code_formatter/calls_test.exs @@ -100,21 +100,6 @@ defmodule Code.Formatter.CallsTest do @short_length end - test "for binaries" do - bad = "foo(<<1, 2, 3, 4>>)" - - good = """ - foo(<< - 1, - 2, - 3, - 4 - >>) - """ - - assert_format bad, good, @short_length - end - test "for lists" do bad = "foo([1, 2, 3, 4])" @@ -146,6 +131,40 @@ defmodule Code.Formatter.CallsTest do assert_format bad, good, @medium_length end + + test "for binaries only on eol" do + bad = "foo(<<1, 2, 3, 4>>)" + + good = """ + foo( + <<1, 2, + 3, 4>> + ) + """ + + assert_format bad, good, @short_length + + bad = """ + foo(<< + # foo + 1, + 2, + 3, + 4>>) + """ + + good = """ + foo(<< + # foo + 1, + 2, + 3, + 4 + >>) + """ + + assert_format bad, good, @short_length + end end describe "local calls" do diff --git a/lib/elixir/test/elixir/code_formatter/containers_test.exs b/lib/elixir/test/elixir/code_formatter/containers_test.exs index a47df6fed65..055dfb86e93 100644 --- a/lib/elixir/test/elixir/code_formatter/containers_test.exs +++ b/lib/elixir/test/elixir/code_formatter/containers_test.exs @@ -18,16 +18,12 @@ defmodule Code.Formatter.ContainersTest do assert_format "{1,2,3}", "{1, 2, 3}" end - test "is strict on line limits" do + test "is flex on line limits" do bad = "{1, 2, 3, 4}" good = """ - { - 1, - 2, - 3, - 4 - } + {1, 2, 3, + 4} """ assert_format bad, good, @short_length @@ -261,16 +257,12 @@ defmodule Code.Formatter.ContainersTest do assert_same "<<(<> <- x)>>" end - test "is strict on line limits" do + test "is flex on line limits" do bad = "<<1, 2, 3, 4>>" good = """ - << - 1, - 2, - 3, - 4 - >> + <<1, 2, 3, + 4>> """ assert_format bad, good, @short_length diff --git a/lib/elixir/test/elixir/code_formatter/integration_test.exs b/lib/elixir/test/elixir/code_formatter/integration_test.exs index 4555939cb51..06d264a6731 100644 --- a/lib/elixir/test/elixir/code_formatter/integration_test.exs +++ b/lib/elixir/test/elixir/code_formatter/integration_test.exs @@ -399,17 +399,20 @@ defmodule Code.Formatter.IntegrationTest do assert_format bad, """ @document Parser.parse( - {"html", [], [ - {"head", [], []}, - {"body", [], [ - {"div", [], [ - {"p", [], ["1"]}, - {"p", [], ["2"]}, - {"div", [], [{"p", [], ["3"]}, {"p", [], ["4"]}]}, - {"p", [], ["5"]} + {"html", [], + [ + {"head", [], []}, + {"body", [], + [ + {"div", [], + [ + {"p", [], ["1"]}, + {"p", [], ["2"]}, + {"div", [], [{"p", [], ["3"]}, {"p", [], ["4"]}]}, + {"p", [], ["5"]} + ]} ]} - ]} - ]} + ]} ) """ end diff --git a/lib/elixir/test/elixir/dynamic_supervisor_test.exs b/lib/elixir/test/elixir/dynamic_supervisor_test.exs index 20e1d33ad3a..25c3dfcd155 100644 --- a/lib/elixir/test/elixir/dynamic_supervisor_test.exs +++ b/lib/elixir/test/elixir/dynamic_supervisor_test.exs @@ -40,13 +40,14 @@ defmodule DynamicSupervisorTest do describe "init/1" do test "set default options" do assert DynamicSupervisor.init(strategy: :one_for_one) == - {:ok, %{ - strategy: :one_for_one, - intensity: 3, - period: 5, - max_children: :infinity, - extra_arguments: [] - }} + {:ok, + %{ + strategy: :one_for_one, + intensity: 3, + period: 5, + max_children: :infinity, + extra_arguments: [] + }} end end diff --git a/lib/elixir/test/elixir/exception_test.exs b/lib/elixir/test/elixir/exception_test.exs index c8de6376d56..18c4dac4916 100644 --- a/lib/elixir/test/elixir/exception_test.exs +++ b/lib/elixir/test/elixir/exception_test.exs @@ -275,11 +275,10 @@ defmodule ExceptionTest do {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) =~ "bad child specification, invalid restart type: :foo" - return = - { - :ok, - {{:one_for_one, 1, 1}, [{:child, {:m, :f, []}, :temporary, :foo, :worker, []}]} - } + return = { + :ok, + {{:one_for_one, 1, 1}, [{:child, {:m, :f, []}, :temporary, :foo, :worker, []}]} + } {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) =~ "bad child specification, invalid shutdown: :foo" @@ -292,51 +291,47 @@ defmodule ExceptionTest do {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) =~ "bad child specification, invalid modules: :foo" - return = - { - :ok, - {{:one_for_one, 1, 1}, [{:child, {:m, :f, []}, :temporary, 1, :worker, [{:foo}]}]} - } + return = { + :ok, + {{:one_for_one, 1, 1}, [{:child, {:m, :f, []}, :temporary, 1, :worker, [{:foo}]}]} + } {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) =~ "bad child specification, invalid module: {:foo}" - return = + return = { + :ok, { - :ok, - { - {:one_for_one, 1, 1}, - [ - {:child, {:m, :f, []}, :permanent, 1, :worker, []}, - {:child, {:m, :f, []}, :permanent, 1, :worker, []} - ] - } + {:one_for_one, 1, 1}, + [ + {:child, {:m, :f, []}, :permanent, 1, :worker, []}, + {:child, {:m, :f, []}, :permanent, 1, :worker, []} + ] } + } {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) =~ "bad child specification, more than one child specification has the id: :child" - return = - { - :ok, - {{:one_for_one, 1, 1}, [{:child, {Kernel, :exit, [:foo]}, :temporary, 1, :worker, []}]} - } + return = { + :ok, + {{:one_for_one, 1, 1}, [{:child, {Kernel, :exit, [:foo]}, :temporary, 1, :worker, []}]} + } {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) assert Exception.format_exit(reason) == "shutdown: failed to start child: :child\n ** (EXIT) :foo" - return = + return = { + :ok, { - :ok, - { - {:one_for_one, 1, 1}, - [{:child, {Kernel, :apply, [fn -> {:error, :foo} end, []]}, :temporary, 1, :worker, []}] - } + {:one_for_one, 1, 1}, + [{:child, {Kernel, :apply, [fn -> {:error, :foo} end, []]}, :temporary, 1, :worker, []}] } + } {:error, reason} = __MODULE__.Sup.start_link(fn -> return end) diff --git a/lib/logger/lib/logger/translator.ex b/lib/logger/lib/logger/translator.ex index aabf41fa5cc..ccbdd6ae1a3 100644 --- a/lib/logger/lib/logger/translator.ex +++ b/lib/logger/lib/logger/translator.ex @@ -76,15 +76,10 @@ defmodule Logger.Translator do end end - def translate( - _min_level, - :info, - :report, - { - :std_info, - [application: app, exited: reason, type: _type] - } - ) do + def translate(_min_level, :info, :report, { + :std_info, + [application: app, exited: reason, type: _type] + }) do {:ok, "Application #{app} exited: #{Application.format_error(reason)}"} end diff --git a/lib/mix/test/mix/tasks/app.start_test.exs b/lib/mix/test/mix/tasks/app.start_test.exs index 8e2c9eaf195..b389a44c923 100644 --- a/lib/mix/test/mix/tasks/app.start_test.exs +++ b/lib/mix/test/mix/tasks/app.start_test.exs @@ -66,13 +66,11 @@ defmodule Mix.Tasks.App.StartTest do Mix.Tasks.Compile.run([]) Mix.Tasks.App.Start.run([]) - assert_received {:mix_shell, :error, [ - "You have configured application :app_unknown_sample" <> _ - ]} + assert_received {:mix_shell, :error, + ["You have configured application :app_unknown_sample" <> _]} - refute_received {:mix_shell, :error, [ - "You have configured application :app_loaded_sample" <> _ - ]} + refute_received {:mix_shell, :error, + ["You have configured application :app_loaded_sample" <> _]} end end diff --git a/lib/mix/test/mix/umbrella_test.exs b/lib/mix/test/mix/umbrella_test.exs index 97a2e74743a..591728fde06 100644 --- a/lib/mix/test/mix/umbrella_test.exs +++ b/lib/mix/test/mix/umbrella_test.exs @@ -12,9 +12,8 @@ defmodule Mix.UmbrellaTest do Mix.Project.in_project(:umbrella, ".", fn _ -> assert Mix.Project.apps_paths() == %{bar: "apps/bar", foo: "apps/foo"} - assert_received {:mix_shell, :error, [ - "warning: path \"apps/dont_error_on_missing_mixfile\"" <> _ - ]} + assert_received {:mix_shell, :error, + ["warning: path \"apps/dont_error_on_missing_mixfile\"" <> _]} refute_received {:mix_shell, :error, ["warning: path \"apps/dont_error_on_files\"" <> _]} end) @@ -219,9 +218,8 @@ defmodule Mix.UmbrellaTest do assert_received {:mix_shell, :error, ["Dependencies have diverged:"]} - assert_received {:mix_shell, :error, [ - " the dependency foo in mix.exs is overriding a child" <> _ - ]} + assert_received {:mix_shell, :error, + [" the dependency foo in mix.exs is overriding a child" <> _]} end) end end