Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Feb 6, 2025
1 parent 219e885 commit f93e130
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/lit/d8/fuzz_shell_exceptions.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;; Test throwing from JS by calling the throw import.

(module
(import "fuzzing-support" "throw" (func $throw (param i32)))

(func $throwing-js (export "throwing-js")
;; Telling JS to throw with arg 0 leads to a JS exception thrown.
(call $throw
(i32.const 0)
)
)

(func $throwing-tag (export "throwing-tag")
;; A non-0 arg leads to a wasm Tag being thrown.
(call $throw
(i32.const 42)
)
)
)

;; Build to a binary wasm.
;;
;; RUN: wasm-opt %s -o %t.wasm -q

;; Run in node.
;;
;; RUN: v8 %S/../../../scripts/fuzz_shell.js -- %t.wasm | filecheck %s
;;
;; CHECK: [fuzz-exec] calling throwing-js
;; CHECK: exception thrown: some JS error
;; CHECK: [fuzz-exec] calling throwing-tag
;; CHECK: exception thrown: [object WebAssembly.Exception]



0 comments on commit f93e130

Please sign in to comment.