Skip to content

Commit 5128922

Browse files
committed
Silence warnings
1 parent 47b712e commit 5128922

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3424,7 +3424,7 @@ defmodule Kernel do
34243424
34253425
## Examples
34263426
3427-
iex> is_nil(1)
3427+
iex> is_nil(1 + 2)
34283428
false
34293429
34303430
iex> is_nil(nil)

lib/elixir/test/elixir/atom_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Code.require_file("test_helper.exs", __DIR__)
33
defmodule AtomTest do
44
use ExUnit.Case, async: true
55

6-
doctest Atom
6+
doctest Atom, except: [:moduledoc]
77

88
test "to_string/1" do
99
assert "héllo" |> String.to_atom() |> Atom.to_string() == "héllo"

lib/elixir/test/elixir/kernel/raise_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule Kernel.RaiseTest do
1717
try do
1818
raise "a"
1919
rescue
20-
_ -> hd(__STACKTRACE__)
20+
_ -> Enum.fetch!(__STACKTRACE__, 0)
2121
end
2222

2323
file = __ENV__.file |> Path.relative_to_cwd() |> String.to_charlist()

lib/elixir/test/elixir/kernel_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Code.require_file("test_helper.exs", __DIR__)
33
defmodule KernelTest do
44
use ExUnit.Case, async: true
55

6-
doctest Kernel
6+
# Skip these doctests are they emit warnings
7+
doctest Kernel, except: [===: 2, !==: 2, is_nil: 1]
78

89
def id(arg), do: arg
910
def id(arg1, arg2), do: {arg1, arg2}

lib/elixir/test/elixir/macro_test.exs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,16 @@ defmodule MacroTest do
379379
"""
380380
end
381381

382+
defp abc, do: [:a, :b, :c]
383+
382384
test "with a pipeline on a single line" do
383-
{result, formatted} = dbg_format([:a, :b, :c] |> tl() |> tl |> Kernel.hd())
385+
{result, formatted} = dbg_format(abc() |> tl() |> tl |> Kernel.hd())
384386
assert result == :c
385387

386388
assert formatted =~ "macro_test.exs"
387389

388390
assert formatted =~ """
389-
\n[:a, :b, :c] #=> [:a, :b, :c]
391+
\nabc() #=> [:a, :b, :c]
390392
|> tl() #=> [:b, :c]
391393
|> tl #=> [:c]
392394
|> Kernel.hd() #=> :c
@@ -400,7 +402,7 @@ defmodule MacroTest do
400402
test "with a pipeline on multiple lines" do
401403
{result, formatted} =
402404
dbg_format(
403-
[:a, :b, :c]
405+
abc()
404406
|> tl()
405407
|> tl
406408
|> Kernel.hd()
@@ -411,7 +413,7 @@ defmodule MacroTest do
411413
assert formatted =~ "macro_test.exs"
412414

413415
assert formatted =~ """
414-
\n[:a, :b, :c] #=> [:a, :b, :c]
416+
\nabc() #=> [:a, :b, :c]
415417
|> tl() #=> [:b, :c]
416418
|> tl #=> [:c]
417419
|> Kernel.hd() #=> :c

0 commit comments

Comments
 (0)