@@ -43,7 +43,7 @@ let suites =
43
43
ok (v_output.exit_code = 0 ) v_output
44
44
end;
45
45
__LOC__ > :: begin fun _ ->
46
- let v_output = perform_bsc [|" -bs-eval" ; {| type 'a arra = 'a array
46
+ let v_output = perform_bsc [|" -bs-eval" ; {| type 'a arra = 'a array
47
47
external
48
48
f :
49
49
int -> int -> int arra -> unit
@@ -52,8 +52,8 @@ let suites =
52
52
[@@ bs.splice]|}|] in
53
53
OUnit. assert_bool __LOC__ (Ext_string. contain_substring v_output.stderr " variadic" )
54
54
end;
55
- __LOC__ > :: begin fun _ ->
56
- let v_output = perform_bsc [|" -bs-eval" ; {| external
55
+ __LOC__ > :: begin fun _ ->
56
+ let v_output = perform_bsc [|" -bs-eval" ; {| external
57
57
f2 :
58
58
int -> int -> ?y:int array -> unit
59
59
= ""
@@ -69,13 +69,13 @@ let suites =
69
69
OUnit. assert_bool __LOC__ (Ext_string. contain_substring
70
70
should_be_warning.stderr " Unused" )
71
71
end;
72
- __LOC__ > :: begin fun _ ->
72
+ __LOC__ > :: begin fun _ ->
73
73
let should_be_warning =
74
74
bsc_check_eval {| external mk : int -> ([`a |`b [@ bs.string ]]) = " mk" [@@ bs.val] |} in
75
- OUnit .assert_bool __LOC__
75
+ OUnit .assert_bool __LOC__
76
76
(Ext_string .contain_substring
77
- should_be_warning .stderr "Unused" )
78
- end;
77
+ should_be_warning .stderr "Unused" )
78
+ end;
79
79
__LOC__ > :: begin fun _ ->
80
80
let should_err = bsc_check_eval {|
81
81
external ff :
@@ -178,12 +178,12 @@ external ff :
178
178
end;
179
179
180
180
(* __LOC__ >:: begin fun _ ->
181
- let should_err = bsc_check_eval {|
182
- external f : string -> unit -> unit = "x.y" [@@bs.send]
183
- |} in
184
- OUnit.assert_bool __LOC__
181
+ let should_err = bsc_check_eval {|
182
+ external f : string -> unit -> unit = "x.y" [@@bs.send]
183
+ |} in
184
+ OUnit.assert_bool __LOC__
185
185
(Ext_string.contain_substring should_err.stderr "Not a valid method name")
186
- end; *)
186
+ end; *)
187
187
188
188
189
189
__LOC__ > :: begin fun _ ->
@@ -193,7 +193,7 @@ type t10 = A of t10 [@@ocaml.unboxed];;
193
193
let rec x = A x;;
194
194
| } in
195
195
OUnit. assert_bool __LOC__
196
- (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
196
+ (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
197
197
end;
198
198
199
199
__LOC__ > :: begin fun _ ->
@@ -202,15 +202,15 @@ let rec x = A x;;
202
202
let rec x = {x = y} and y = 3L ;;
203
203
| } in
204
204
OUnit. assert_bool __LOC__
205
- (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
205
+ (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
206
206
end;
207
207
__LOC__ > :: begin fun _ ->
208
208
let should_err = bsc_check_eval {|
209
209
type r = A of r [@@ unboxed];;
210
210
let rec y = A y;;
211
211
| } in
212
212
OUnit. assert_bool __LOC__
213
- (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
213
+ (Ext_string. contain_substring should_err.stderr " This kind of expression is not allowed" )
214
214
end;
215
215
216
216
__LOC__ > :: begin fun _ ->
@@ -253,60 +253,71 @@ let rec y = A y;;
253
253
254
254
end;
255
255
__LOC__ > :: begin fun _ ->
256
- let should_err = bsc_check_eval {|
256
+ let should_err = bsc_check_eval {|
257
257
external foo_bar :
258
258
(_ [@ bs.as "foo" ]) ->
259
259
string ->
260
260
string = " bar"
261
261
[@@ bs.send]
262
262
|} in
263
- OUnit .assert_bool __LOC__
264
- (Ext_string .contain_substring should_err .stderr "Ill defined attribute" )
265
- end;
263
+ OUnit .assert_bool __LOC__
264
+ (Ext_string .contain_substring should_err .stderr "Ill defined attribute" )
265
+ end;
266
266
__LOC__ > :: begin fun _ ->
267
- let should_err = bsc_check_eval {|
267
+ let should_err = bsc_check_eval {|
268
268
let bla4 foo x y = foo##(method1 x y [@ bs])
269
269
| } in
270
- (* Ounit_cmd_util.debug_output should_err ; *)
271
- OUnit. assert_bool __LOC__
272
- (Ext_string. contain_substring should_err.stderr
273
- " Unused" )
274
- end;
270
+ (* Ounit_cmd_util.debug_output should_err ; *)
271
+ OUnit. assert_bool __LOC__
272
+ (Ext_string. contain_substring should_err.stderr
273
+ " Unused" )
274
+ end;
275
275
__LOC__ > :: begin fun _ ->
276
- let should_err = bsc_check_eval {|
276
+ let should_err = bsc_check_eval {|
277
277
external mk : int ->
278
278
(
279
279
[`a |`b ]
280
280
[@ bs.string ]
281
281
) = " mk" [@@ bs.val]
282
282
|} in
283
- (* Ounit_cmd_util.debug_output should_err ; *)
284
- OUnit .assert_bool __LOC__
285
- (Ext_string .contain_substring should_err .stderr
286
- "Unused" )
287
- end;
288
- __LOC__ > :: begin fun _ ->
289
- let should_err = bsc_check_eval {|
283
+ (* Ounit_cmd_util.debug_output should_err ; *)
284
+ OUnit .assert_bool __LOC__
285
+ (Ext_string .contain_substring should_err .stderr
286
+ "Unused" )
287
+ end;
288
+ __LOC__ > :: begin fun _ ->
289
+ let should_err = bsc_check_eval {|
290
290
type -'a t = {k : 'a } [@@ bs.deriving abstract ]
291
291
|} in
292
- OUnit .assert_bool __LOC__
293
- (Ext_string .contain_substring should_err .stderr "contravariant" )
294
- end;
295
- __LOC__ > :: begin fun _ ->
296
- let should_err = bsc_check_eval {|
292
+ OUnit .assert_bool __LOC__
293
+ (Ext_string .contain_substring should_err .stderr "contravariant" )
294
+ end;
295
+ __LOC__ > :: begin fun _ ->
296
+ let should_err = bsc_check_eval {|
297
297
let u = [||]
298
298
| } in
299
- OUnit. assert_bool __LOC__
300
- (Ext_string. contain_substring should_err.stderr " cannot be generalized" )
301
- end
299
+ OUnit. assert_bool __LOC__
300
+ (Ext_string. contain_substring should_err.stderr " cannot be generalized" )
301
+ end;
302
+ __LOC__ > :: begin fun _ ->
303
+ let should_err = bsc_check_eval {|
304
+ external push : 'a array -> 'a -> unit = " push" [@@ send]
305
+ let a = [||]
306
+ let () =
307
+ push a 3 |. ignore ;
308
+ push a " 3" |. ignore
309
+ | } in
310
+ OUnit. assert_bool __LOC__
311
+ (Ext_string. contain_substring should_err.stderr " has type string" )
312
+ end
302
313
(* __LOC__ >:: begin fun _ -> *)
303
314
(* let should_infer = perform_bsc [| "-i"; "-bs-eval"|] {| *)
304
- (* let f = fun [@bs] x -> let (a,b) = x in a + b *)
305
- (* |} in *)
315
+ (* let f = fun [@bs] x -> let (a,b) = x in a + b *)
316
+ (* |} in *)
306
317
(* let infer_type = bsc_eval (Printf.sprintf {| *)
307
318
308
- (* let f : %s = fun [@bs] x -> let (a,b) = x in a + b *)
309
- (* |} should_infer.stdout ) in *)
319
+ (* let f : %s = fun [@bs] x -> let (a,b) = x in a + b *)
320
+ (* |} should_infer.stdout ) in *)
310
321
(* begin *)
311
322
(* Ounit_cmd_util.debug_output should_infer ; *)
312
323
(* Ounit_cmd_util.debug_output infer_type ; *)
0 commit comments