-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_debug_log_prefixed.expected.ml
115 lines (115 loc) · 5.43 KB
/
test_debug_log_prefixed.expected.ml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
module Debug_runtime = (val
Minidebug_runtime.debug_flushing ~filename:"debugger_show_log_prefixed" ())
;;()
let rec loop_exceeded (x : int) =
(let __entry_id = Debug_runtime.get_entry_id () in
();
(Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:6
~start_colnum:33 ~end_lnum:12 ~end_colnum:55 ~message:"loop_exceeded"
~entry_id:__entry_id ~log_level:1 `Diagn;
());
(match let z : int =
Debug_runtime.log_value_show ?descr:None ~entry_id:__entry_id
~log_level:2 ~is_result:false
(([%show : (string * int)]) ("inside loop", (x : int)));
();
(x - 1) / 2 in
if x <= 0 then 0 else z + (loop_exceeded (z + (x / 2)))
with
| __res ->
(();
Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:6 ~entry_id:__entry_id;
__res)
| exception e ->
(Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:6 ~entry_id:__entry_id;
raise e)) : int)
let () =
try print_endline @@ (Int.to_string @@ (loop_exceeded 7))
with | _ -> print_endline "Raised exception."
let bar () =
(let __entry_id = Debug_runtime.get_entry_id () in
();
Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml" ~start_lnum:18
~start_colnum:19 ~end_lnum:23 ~end_colnum:6 ~message:"bar"
~entry_id:__entry_id ~log_level:1 `Track;
(match let __entry_id = Debug_runtime.get_entry_id () in
Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:19 ~start_colnum:2 ~end_lnum:23 ~end_colnum:6
~message:"for:test_debug_log_prefixed:19" ~entry_id:__entry_id
~log_level:1 `Track;
(match for i = 0 to 10 do
let __entry_id = Debug_runtime.get_entry_id () in
Debug_runtime.log_value_show ?descr:(Some "i")
~entry_id:__entry_id ~log_level:1 ~is_result:false
(([%show : int]) i);
Debug_runtime.open_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:19 ~start_colnum:6 ~end_lnum:19
~end_colnum:7 ~message:"<for i>" ~entry_id:__entry_id
~log_level:1 `Track;
(match let _baz : int =
let __entry_id = Debug_runtime.get_entry_id () in
();
Debug_runtime.open_log
~fname:"test_debug_log_prefixed.ml"
~start_lnum:20 ~start_colnum:8 ~end_lnum:20
~end_colnum:12 ~message:"_baz"
~entry_id:__entry_id ~log_level:1 `Track;
(match i * 2 with
| _baz as __res ->
((();
Debug_runtime.log_value_show
?descr:(Some "_baz")
~entry_id:__entry_id ~log_level:1
~is_result:true (([%show : int]) _baz));
Debug_runtime.close_log
~fname:"test_debug_log_prefixed.ml"
~start_lnum:20 ~entry_id:__entry_id;
__res)
| exception e ->
(Debug_runtime.close_log
~fname:"test_debug_log_prefixed.ml"
~start_lnum:20 ~entry_id:__entry_id;
raise e)) in
Debug_runtime.log_value_show ?descr:None
~entry_id:__entry_id ~log_level:2
~is_result:false
(([%show : (string * int * string * int)])
("loop step", (i : int), "value",
(_baz : int)));
()
with
| () ->
(();
Debug_runtime.close_log
~fname:"test_debug_log_prefixed.ml" ~start_lnum:20
~entry_id:__entry_id;
())
| exception e ->
(Debug_runtime.close_log
~fname:"test_debug_log_prefixed.ml" ~start_lnum:20
~entry_id:__entry_id;
raise e))
done
with
| () ->
Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:19 ~entry_id:__entry_id
| exception e ->
(Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:19 ~entry_id:__entry_id;
raise e))
with
| __res ->
(Debug_runtime.log_value_show ?descr:(Some "bar")
~entry_id:__entry_id ~log_level:1 ~is_result:true
(([%show : unit]) __res);
Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:18 ~entry_id:__entry_id;
__res)
| exception e ->
(Debug_runtime.close_log ~fname:"test_debug_log_prefixed.ml"
~start_lnum:18 ~entry_id:__entry_id;
raise e)) : unit)
let () = try bar () with | _ -> print_endline "Raised exception."