summaryrefslogtreecommitdiff
path: root/test/lit/exec/eh-legacy.wast
blob: 930e57c202f1e3497edadd8ed9170b64253235e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.

;; RUN: wasm-opt %s -all --fuzz-exec -q -o /dev/null 2>&1 | filecheck %s

(module
  (tag $e-i32 (param i32))

  ;; CHECK:      [fuzz-exec] calling throw
  ;; CHECK-NEXT: [exception thrown: e-i32 1]
  (func $throw (export "throw")
    (throw $e-i32 (i32.const 1))
  )

  ;; CHECK:      [fuzz-exec] calling try-catch
  (func $try-catch (export "try-catch")
    (try
      (do
        (throw $e-i32 (i32.const 2))
      )
      (catch $e-i32
        (drop (pop i32))
      )
    )
  )

  ;; CHECK:      [fuzz-exec] calling catchless-try
  ;; CHECK-NEXT: [exception thrown: e-i32 3]
  (func $catchless-try (export "catchless-try")
    (try
      (do
        (throw $e-i32 (i32.const 3))
      )
    )
  )

  ;; CHECK:      [fuzz-exec] calling try-delegate
  ;; CHECK-NEXT: [exception thrown: e-i32 4]
  (func $try-delegate (export "try-delegate")
    (try $l0
      (do
        (try
          (do
            (throw $e-i32 (i32.const 4))
          )
          (delegate $l0)
        )
      )
    )
  )
)
;; CHECK:      [fuzz-exec] calling throw
;; CHECK-NEXT: [exception thrown: e-i32 1]

;; CHECK:      [fuzz-exec] calling try-catch

;; CHECK:      [fuzz-exec] calling catchless-try
;; CHECK-NEXT: [exception thrown: e-i32 3]

;; CHECK:      [fuzz-exec] calling try-delegate
;; CHECK-NEXT: [exception thrown: e-i32 4]
;; CHECK-NEXT: [fuzz-exec] comparing catchless-try
;; CHECK-NEXT: [fuzz-exec] comparing throw
;; CHECK-NEXT: [fuzz-exec] comparing try-catch
;; CHECK-NEXT: [fuzz-exec] comparing try-delegate