File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments