Skip to content

Commit 092089d

Browse files
authored
Merge pull request #202 from boydm/clean_up_warnings
Clean up warnings
2 parents 3d305bf + a01fd62 commit 092089d

File tree

10 files changed

+91
-14
lines changed

10 files changed

+91
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.10.4
4+
* Can pass in a :name option to scenes/components @am-kantox
5+
* Clean up warnings under Elixir 1.11
6+
* Tell git not to mangle line endings on test data - part of getting Windows support working. @trejkaz
7+
8+
39
## 0.10.3
410
* Fix bug allowing handle_continue to be overridden by scene. Thank you @lmarlow
511
* Fix bug where font in a style map wasn't being honored during graph build

lib/scenic.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ defmodule Scenic do
8585
defp do_init([]) do
8686
[
8787
{Scenic.ViewPort.Tables, nil},
88-
supervisor(Scenic.Cache.Support.Supervisor, []),
88+
{Scenic.Cache.Support.Supervisor, [nil]},
8989
{DynamicSupervisor, name: @viewports, strategy: :one_for_one}
9090
]
9191
|> Supervisor.init(strategy: :one_for_one)
@@ -96,8 +96,8 @@ defmodule Scenic do
9696
defp do_init(viewports) do
9797
[
9898
{Scenic.ViewPort.Tables, nil},
99-
supervisor(Scenic.Cache.Support.Supervisor, []),
100-
supervisor(Scenic.ViewPort.SupervisorTop, [viewports]),
99+
{Scenic.Cache.Support.Supervisor, [nil]},
100+
{Scenic.ViewPort.SupervisorTop, [viewports]},
101101
{DynamicSupervisor, name: @viewports, strategy: :one_for_one}
102102
]
103103
|> Supervisor.init(strategy: :one_for_one)

lib/scenic/cache/base.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ defmodule Scenic.Cache.Base do
11211121
GenServer.cast(pid, {module, type, target})
11221122
catch
11231123
kind, reason ->
1124-
formatted = Exception.format(kind, reason, System.stacktrace())
1124+
formatted = Exception.format(kind, reason, __STACKTRACE__)
11251125
IO.puts("dispatch_notification/3 failed with #{formatted}")
11261126
end
11271127
end

lib/scenic/cache/support/supervisor.ex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@ defmodule Scenic.Cache.Support.Supervisor do
1111

1212
# import IEx
1313

14+
def child_spec() do
15+
%{
16+
id: __MODULE__,
17+
start: {__MODULE__, :start_link, nil},
18+
type: :supervisor,
19+
restart: :permanent,
20+
shutdown: 500
21+
}
22+
end
23+
1424
# ============================================================================
1525
# setup the viewport supervisor
1626

17-
def start_link() do
27+
def start_link(_) do
1828
Supervisor.start_link(__MODULE__, :ok)
1929
end
2030

lib/scenic/view_port/supervisor_top.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ defmodule Scenic.ViewPort.SupervisorTop do
1717
# ============================================================================
1818
# setup the viewport supervisor
1919

20+
def child_spec(viewports) do
21+
%{
22+
id: __MODULE__,
23+
start: {__MODULE__, :start_link, viewports},
24+
type: :supervisor,
25+
restart: :permanent,
26+
shutdown: 500
27+
}
28+
end
29+
2030
def start_link(viewports) do
2131
Supervisor.start_link(__MODULE__, viewports)
2232
end

mix.exs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ defmodule Scenic.Mixfile do
3636
end
3737

3838
def application do
39-
[
40-
# mod: {Scenic, []},
41-
extra_applications: [:logger]
42-
]
39+
[extra_applications: [:logger, :crypto, :iex]]
4340
end
4441

4542
defp deps do
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Created by Boyd Multerer on 2020-11-02.
3+
# Copyright © 2020 Kry10 Limited. All rights reserved.
4+
#
5+
6+
# putting read and load in separate modules (both in this file)
7+
# because load needs the cache to be set up and read doesn't.
8+
9+
defmodule Scenic.Cache.Support.SupervisorTest do
10+
use ExUnit.Case, async: true
11+
doctest Scenic.Cache.Support.Supervisor
12+
13+
alias Scenic.Cache.Support.Supervisor, as: Super
14+
15+
# ============================================================================
16+
17+
test "child_spec is as expected" do
18+
assert Super.child_spec() == %{
19+
id: Super,
20+
start: {Super, :start_link, nil},
21+
type: :supervisor,
22+
restart: :permanent,
23+
shutdown: 500
24+
}
25+
end
26+
end

test/scenic/view_port/input_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ defmodule Scenic.ViewPort.InputTest do
415415
}
416416
)
417417

418-
assert_received({:"$gen_cast", {:input, {:viewport_enter, :viewport_enter_input}, context}})
418+
assert_received({:"$gen_cast", {:input, {:viewport_enter, :viewport_enter_input}, _}})
419419
end
420420

421421
test "input viewport_exit", %{graph_key: graph_key} do
@@ -429,7 +429,7 @@ defmodule Scenic.ViewPort.InputTest do
429429
}
430430
)
431431

432-
assert_received({:"$gen_cast", {:input, {:viewport_exit, :viewport_exit_input}, context}})
432+
assert_received({:"$gen_cast", {:input, {:viewport_exit, :viewport_exit_input}, _}})
433433
end
434434

435435
test "input other", %{graph_key: graph_key} do
@@ -443,7 +443,7 @@ defmodule Scenic.ViewPort.InputTest do
443443
}
444444
)
445445

446-
assert_received({:"$gen_cast", {:input, {:other, 123}, context}})
446+
assert_received({:"$gen_cast", {:input, {:other, 123}, _}})
447447
end
448448

449449
# ============================================================================
@@ -727,7 +727,7 @@ defmodule Scenic.ViewPort.InputTest do
727727
}
728728
)
729729

730-
assert_received({:"$gen_cast", {:input, {:cursor_pos, {1.0, 1.0}}, context}})
730+
assert_received({:"$gen_cast", {:input, {:cursor_pos, {1.0, 1.0}}, _}})
731731
assert_received({:"$gen_cast", {:input, {:cursor_exit, 1}, _}})
732732
refute_received({:"$gen_cast", {:input, {:cursor_enter, _}, _}})
733733
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# Created by Boyd Multerer on 2020-11-02.
3+
# Copyright © 2020 Kry10 Limited. All rights reserved.
4+
#
5+
6+
# putting read and load in separate modules (both in this file)
7+
# because load needs the cache to be set up and read doesn't.
8+
9+
defmodule Scenic.ViewPort.SupervisorTopTest do
10+
use ExUnit.Case, async: true
11+
doctest Scenic.ViewPort.SupervisorTop
12+
13+
alias Scenic.ViewPort.SupervisorTop, as: Super
14+
15+
# ============================================================================
16+
17+
test "child_spec is as expected" do
18+
list = [1, 2, 3]
19+
20+
assert Super.child_spec(list) == %{
21+
id: Super,
22+
start: {Super, :start_link, list},
23+
type: :supervisor,
24+
restart: :permanent,
25+
shutdown: 500
26+
}
27+
end
28+
end

test/test_helper.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Registry.start_link(keys: :duplicate, name: :viewport_registry)
22
Registry.start_link(keys: :duplicate, name: :input_registry)
33
Registry.start_link(keys: :duplicate, name: :driver_registry)
4-
Scenic.Cache.Support.Supervisor.start_link()
4+
Scenic.Cache.Support.Supervisor.start_link(nil)
55
ExUnit.start()

0 commit comments

Comments
 (0)