Skip to content

Commit dc6af59

Browse files
Siddhi-aggNathanReb
authored andcommitted
used int exit codes
1 parent a442c47 commit dc6af59

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

bin/api_diff.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let run (`Ref_cmi reference) (`Current_cmi current) =
2525
~current:current_sig
2626
in
2727
match diff with
28-
| None -> Ok ()
28+
| None -> Ok 0
2929
| Some diff ->
3030
let text_diff = Api_watch.Text_diff.from_diff diff in
3131
let print_module_diff module_path diff =
@@ -34,7 +34,7 @@ let run (`Ref_cmi reference) (`Current_cmi current) =
3434
Printf.printf "\n"
3535
in
3636
Api_watch.String_map.iter print_module_diff text_diff;
37-
Ok ()
37+
Ok 1
3838

3939
let named f = Cmdliner.Term.(app (const f))
4040

@@ -60,5 +60,5 @@ let info =
6060
let term = Cmdliner.Term.(const run $ ref_cmi $ current_cmi)
6161

6262
let () =
63-
let exit_code = Cmdliner.Cmd.eval_result (Cmdliner.Cmd.v info term) in
63+
let exit_code = Cmdliner.Cmd.eval_result' (Cmdliner.Cmd.v info term) in
6464
exit exit_code

tests/api-diff/run.t

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Run api-watcher on the two cmi files, there should be a difference
4949
diff module Add_type:
5050

5151
+<unsupported change>
52+
[1]
5253

5354
### A file with a removed type:
5455

@@ -67,6 +68,7 @@ Run api-watcher on the two cmi files, there should be a difference
6768
diff module Remove_type:
6869

6970
+<unsupported change>
71+
[1]
7072

7173
### A file with a modified type:
7274

@@ -86,6 +88,7 @@ Run api-watcher on the two cmi files, there should be a difference
8688
diff module Modify_type:
8789

8890
+<unsupported change>
91+
[1]
8992

9093
## Different .cmi files for value tests:
9194

@@ -107,6 +110,7 @@ Run api-diff and check the output
107110
diff module Add_value:
108111

109112
+val g : t -> t
113+
[1]
110114

111115
### Removing a value:
112116

@@ -124,6 +128,7 @@ Run api-diff and check the output
124128
diff module Remove_value:
125129

126130
-val f : t -> string
131+
[1]
127132

128133
### Modifying a value:
129134

@@ -143,6 +148,7 @@ Run api-diff and check the output
143148

144149
-val f : t -> string
145150
+val f : t -> t
151+
[1]
146152

147153
Here we generate a `.mli` file with a module:
148154

@@ -177,6 +183,7 @@ Run api-diff and check the output
177183
diff module Add_module:
178184

179185
+module N: sig val y : float end
186+
[1]
180187

181188
### Removing a module:
182189

@@ -193,6 +200,7 @@ Run api-diff and check the output
193200
diff module Remove_module:
194201

195202
-module M: sig val x : int end
203+
[1]
196204

197205
### Modifying a module:
198206

@@ -211,6 +219,7 @@ Run api-diff and check the output
211219

212220
-val x : int
213221
+val x : float
222+
[1]
214223

215224
Generate a new .mli file with values and submodules
216225
$ cat > orig_module.mli << EOF
@@ -258,6 +267,7 @@ Run api-diff and check the output
258267
-val g : int -> string
259268
+val g : int -> (string, string) result
260269

270+
[1]
261271

262272
Create the first version of a simple project
263273
$ mkdir -p project_v1/lib
@@ -367,3 +377,4 @@ Run the api-diff tool on the two project versions
367377
diff module project_v2.Mylib__Utils:
368378
+val triple : int -> int
369379

380+
[1]

0 commit comments

Comments
 (0)