Skip to content

Commit 0e0f28a

Browse files
fixup! more tests
1 parent 3fbaf8b commit 0e0f28a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/unit/wasi_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,26 @@ module Wasmtime
304304

305305
expect(File.read(tempfile_path(File.join("tmp", "counter")))).to eq("0")
306306
end
307+
308+
it "does not accept an invalid host path" do
309+
wasi_config = WasiConfig.new
310+
.set_mapped_directory(tempfile_path("tmp"), "/tmp", :all, :all)
311+
312+
expect { run_fs.call(wasi_config) }.to raise_error do |error|
313+
expect(error).to be_a(Wasmtime::Error)
314+
expect(error.message).to match(/No such file or directory/)
315+
end
316+
end
317+
318+
it "does not accept invalid permissions" do
319+
wasi_config = WasiConfig.new
320+
.set_mapped_directory(tempfile_path("tmp"), "/tmp", :mutate, :invalid_permission)
321+
322+
expect { run_fs.call(wasi_config) }.to raise_error do |error|
323+
expect(error).to be_a(Wasmtime::Error)
324+
expect(error.message).to match(/Invalid file_perms: invalid_permission. Use one of :read, :write, or :all/)
325+
end
326+
end
307327
end
308328

309329
describe "WasiConfig preview 1" do

0 commit comments

Comments
 (0)