Skip to content

Commit 0736e07

Browse files
authored
Merge pull request #257 from emillon/suppress-deprecation-warnings-in-tests
Suppress deprecation warnings in tests
2 parents e9eb240 + 275c24d commit 0736e07

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

fuzz/fuzz.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ let () =
117117
check (Cstruct.get_uint8 c i = x land 0xff)
118118
);
119119
add_test ~name:"set_len" [cstruct; int] (fun base len ->
120-
match Cstruct.set_len base len with
120+
match[@ocaml.warning "-3"] Cstruct.set_len base len with
121121
| x ->
122122
(* check_within ~base x; *) (* Maybe deprecate set_len extending the allocation? *)
123123
check (Cstruct.len x >= 0);
@@ -126,7 +126,7 @@ let () =
126126
| exception Invalid_argument _ -> ()
127127
);
128128
add_test ~name:"add_len" [cstruct; int] (fun base len ->
129-
match Cstruct.add_len base len with
129+
match[@ocaml.warning "-3"] Cstruct.add_len base len with
130130
| x ->
131131
check (Cstruct.len x >= 0);
132132
check (Cstruct.len x <= Bigarray.Array1.dim (base.Cstruct.buffer));

lib_test/bounds.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,28 +166,28 @@ let test_of_bigarray_large_length () =
166166
let test_set_len_too_big () =
167167
let x = Cstruct.create 0 in
168168
try
169-
let y = Cstruct.set_len x 1 in
169+
let[@ocaml.warning "-3"] y = Cstruct.set_len x 1 in
170170
failwith (Printf.sprintf "test_set_len_too_big: %s" (to_string y))
171171
with Invalid_argument _ -> ()
172172

173173
let test_set_len_too_small () =
174174
let x = Cstruct.create 0 in
175175
try
176-
let y = Cstruct.set_len x (-1) in
176+
let[@ocaml.warning "-3"] y = Cstruct.set_len x (-1) in
177177
failwith (Printf.sprintf "test_set_len_too_small: %s" (to_string y))
178178
with Invalid_argument _ -> ()
179179

180180
let test_add_len_too_big () =
181181
let x = Cstruct.create 0 in
182182
try
183-
let y = Cstruct.add_len x 1 in
183+
let[@ocaml.warning "-3"] y = Cstruct.add_len x 1 in
184184
failwith (Printf.sprintf "test_add_len_too_big: %s" (to_string y))
185185
with Invalid_argument _ -> ()
186186

187187
let test_add_len_too_small () =
188188
let x = Cstruct.create 0 in
189189
try
190-
let y = Cstruct.add_len x (-1) in
190+
let[@ocaml.warning "-3"] y = Cstruct.add_len x (-1) in
191191
failwith (Printf.sprintf "test_add_len_too_small: %s" (to_string y))
192192
with Invalid_argument _ -> ()
193193

0 commit comments

Comments
 (0)