summaryrefslogtreecommitdiff
path: root/testsuite/tests/backtrace/lazy.ml
blob: c6a0626b42e176e9ef442cf4a400567a311e84d0 (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
(* TEST_BELOW *)

let l1 : unit lazy_t = lazy (raise Not_found)

let test1 () =
  let () = Lazy.force l1 in ()

let l2 : unit lazy_t = lazy (raise Not_found)

let test2 () =
  let (lazy ()) = l2 in ()

let run test =
  try
    test ();
  with exn ->
    Printf.printf "Uncaught exception %s\n" (Printexc.to_string exn);
    Printexc.print_backtrace stdout

let () =
  Printexc.record_backtrace true;
  run test1;
  run test2


(* TEST

flags = "-g"
* no-flambda
** native
* flambda
reference = "${test_source_directory}/lazy.flambda.reference"
** native

*)