File tree Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ defmodule Scenic.Cache.Term do
11
11
alias Scenic.Cache
12
12
alias Scenic.Cache.Hash
13
13
14
- # import IEx
14
+ # import IEx
15
15
16
16
# --------------------------------------------------------
17
17
def load ( path , hash , opts \\ [ ] )
Original file line number Diff line number Diff line change @@ -88,6 +88,15 @@ defmodule Scenic.Cache.FileReadTest do
88
88
decompress: true
89
89
) == { :error , :hash_failure }
90
90
end
91
+
92
+ test "read passes through errors" do
93
+ # missing term file
94
+ assert Cache.File . read (
95
+ "not/valid/path" ,
96
+ @ invalid_sha256 ,
97
+ hash: :sha256
98
+ ) == { :error , :enoent }
99
+ end
91
100
end
92
101
93
102
defmodule Scenic.Cache.FileLoadTest do
@@ -187,4 +196,13 @@ defmodule Scenic.Cache.FileLoadTest do
187
196
decompress: true
188
197
) == { :error , :hash_failure }
189
198
end
199
+
200
+ test "load passes through errors" do
201
+ # missing term file
202
+ assert Cache.File . load (
203
+ "not/valid/path" ,
204
+ @ invalid_sha256 ,
205
+ hash: :sha256
206
+ ) == { :error , :enoent }
207
+ end
190
208
end
Original file line number Diff line number Diff line change @@ -75,6 +75,15 @@ defmodule Scenic.Cache.TermReadTest do
75
75
@ sample_sha
76
76
) == { :error , :invalid_term }
77
77
end
78
+
79
+ test "read passes through errors" do
80
+ # missing term file
81
+ assert Cache.Term . read (
82
+ "not/valid/path" ,
83
+ @ invalid_sha256 ,
84
+ hash: :sha256
85
+ ) == { :error , :enoent }
86
+ end
78
87
end
79
88
80
89
defmodule Scenic.Cache.TermLoadTest do
@@ -98,6 +107,9 @@ defmodule Scenic.Cache.TermLoadTest do
98
107
@ sample_path "test/artifacts/sample_file"
99
108
@ sample_sha "2PGNXGkoTc4stYncIe-qCdZFuw0"
100
109
110
+ @ non_term_path "test/artifacts/sample_file"
111
+ @ non_term_sha "2PGNXGkoTc4stYncIe-qCdZFuw0"
112
+
101
113
@ cache_table :scenic_cache_key_table
102
114
@ scope_table :scenic_cache_scope_table
103
115
@@ -155,4 +167,19 @@ defmodule Scenic.Cache.TermLoadTest do
155
167
@ sample_sha
156
168
) == { :error , :invalid_term }
157
169
end
170
+
171
+ test "load passes through errors" do
172
+ # missing term file
173
+ assert Cache.Term . load (
174
+ "not/valid/path" ,
175
+ @ invalid_sha256 ,
176
+ hash: :sha256
177
+ ) == { :error , :enoent }
178
+
179
+ # badly formatted term file
180
+ assert Cache.Term . load (
181
+ @ non_term_path ,
182
+ @ non_term_sha
183
+ ) == { :error , :invalid_term }
184
+ end
158
185
end
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ defmodule Scenic.GraphTest do
14
14
alias Scenic.Primitive.Rectangle
15
15
alias Scenic.Primitive.Line
16
16
17
- import IEx
17
+ # import IEx
18
18
19
19
@ root_uid 0
20
20
You can’t perform that action at this time.
0 commit comments