@@ -3913,153 +3913,153 @@ let (=~) = OUnit.assert_equal
3913
3913
3914
3914
3915
3915
(* let output_of_exec_command command args =
3916
- let readme, writeme = Unix.pipe () in
3917
- let pid = Unix.create_process command args Unix.stdin writeme Unix.stderr in
3916
+ let readme, writeme = Unix.pipe () in
3917
+ let pid = Unix.create_process command args Unix.stdin writeme Unix.stderr in
3918
3918
let in_chan = Unix.in_channel_of_descr readme *)
3919
3919
3920
3920
3921
3921
3922
3922
let perform_bsc = Ounit_cmd_util.perform_bsc
3923
- let bsc_check_eval = Ounit_cmd_util.bsc_check_eval
3923
+ let bsc_check_eval = Ounit_cmd_util.bsc_check_eval
3924
3924
3925
3925
3926
- let suites =
3926
+ let suites =
3927
3927
__FILE__
3928
3928
>::: [
3929
- __LOC__ >:: begin fun _ ->
3930
- let v_output = perform_bsc [| "-v" |] in
3929
+ __LOC__ >:: begin fun _ ->
3930
+ let v_output = perform_bsc [| "-v" |] in
3931
3931
OUnit.assert_bool __LOC__ ((perform_bsc [| "-h" |]).exit_code <> 0 );
3932
3932
OUnit.assert_bool __LOC__ (v_output.exit_code = 0);
3933
3933
(* Printf.printf "\n*>%s" v_output.stdout; *)
3934
3934
(* Printf.printf "\n*>%s" v_output.stderr ; *)
3935
- end;
3936
- __LOC__ >:: begin fun _ ->
3937
- let v_output =
3938
- perform_bsc [| "-bs-eval"; {|let str = "'a'" |}|] in
3935
+ end;
3936
+ __LOC__ >:: begin fun _ ->
3937
+ let v_output =
3938
+ perform_bsc [| "-bs-eval"; {|let str = "'a'" |}|] in
3939
3939
OUnit.assert_bool __LOC__ (v_output.exit_code = 0)
3940
3940
end;
3941
- __LOC__ >:: begin fun _ ->
3942
- let should_be_warning =
3943
- bsc_check_eval {|let bla4 foo x y= foo##(method1 x y [@bs]) |} in
3941
+ __LOC__ >:: begin fun _ ->
3942
+ let should_be_warning =
3943
+ bsc_check_eval {|let bla4 foo x y= foo##(method1 x y [@bs]) |} in
3944
3944
(* debug_output should_be_warning; *)
3945
3945
OUnit.assert_bool __LOC__ (Ext_string.contain_substring
3946
3946
should_be_warning.stderr "Unused")
3947
3947
end;
3948
- __LOC__ >:: begin fun _ ->
3949
- let should_be_warning =
3950
- bsc_check_eval {| external mk : int -> ([`a|`b [@bs.string]]) = "" [@@bs.val] |} in
3951
- OUnit.assert_bool __LOC__
3948
+ __LOC__ >:: begin fun _ ->
3949
+ let should_be_warning =
3950
+ bsc_check_eval {| external mk : int -> ([`a|`b [@bs.string]]) = "" [@@bs.val] |} in
3951
+ OUnit.assert_bool __LOC__
3952
3952
(Ext_string.contain_substring
3953
3953
should_be_warning.stderr "Unused")
3954
3954
end;
3955
- __LOC__ >:: begin fun _ ->
3955
+ __LOC__ >:: begin fun _ ->
3956
3956
let should_err = bsc_check_eval {|
3957
- external ff :
3958
- resp -> (_ [@bs.as "x"]) -> int -> unit =
3959
- "x" [@@bs.set]
3960
- |} in
3961
- OUnit.assert_bool __LOC__
3957
+ external ff :
3958
+ resp -> (_ [@bs.as "x"]) -> int -> unit =
3959
+ "x" [@@bs.set]
3960
+ |} in
3961
+ OUnit.assert_bool __LOC__
3962
3962
(Ext_string.contain_substring should_err.stderr
3963
3963
"Ill defined"
3964
3964
)
3965
3965
end;
3966
3966
3967
- __LOC__ >:: begin fun _ ->
3968
- (** used in return value
3969
- This should fail, we did not
3967
+ __LOC__ >:: begin fun _ ->
3968
+ (** used in return value
3969
+ This should fail, we did not
3970
3970
support uncurry return value yet
3971
3971
*)
3972
3972
let should_err = bsc_check_eval {|
3973
3973
external v3 :
3974
3974
int -> int -> (int -> int -> int [@bs.uncurry])
3975
3975
= ""[@@bs.val]
3976
3976
3977
- |} in
3977
+ |} in
3978
3978
(* Ounit_cmd_util.debug_output should_err;*)
3979
3979
OUnit.assert_bool __LOC__
3980
- (Ext_string.contain_substring
3980
+ (Ext_string.contain_substring
3981
3981
should_err.stderr "bs.uncurry")
3982
3982
end ;
3983
3983
3984
- __LOC__ >:: begin fun _ ->
3984
+ __LOC__ >:: begin fun _ ->
3985
3985
let should_err = bsc_check_eval {|
3986
- external v4 :
3986
+ external v4 :
3987
3987
(int -> int -> int [@bs.uncurry]) = ""
3988
3988
[@@bs.val]
3989
3989
3990
- |} in
3990
+ |} in
3991
3991
(* Ounit_cmd_util.debug_output should_err ; *)
3992
3992
OUnit.assert_bool __LOC__
3993
- (Ext_string.contain_substring
3993
+ (Ext_string.contain_substring
3994
3994
should_err.stderr "bs.uncurry")
3995
3995
end ;
3996
3996
3997
- __LOC__ >:: begin fun _ ->
3997
+ __LOC__ >:: begin fun _ ->
3998
3998
let should_err = bsc_check_eval {|
3999
3999
{js| \uFFF|js}
4000
- |} in
4000
+ |} in
4001
4001
OUnit.assert_bool __LOC__ (not @@ Ext_string.is_empty should_err.stderr)
4002
4002
end;
4003
4003
4004
- __LOC__ >:: begin fun _ ->
4004
+ __LOC__ >:: begin fun _ ->
4005
4005
let should_err = bsc_check_eval {|
4006
4006
external mk : int -> ([`a|`b] [@bs.string]) = "" [@@bs.val]
4007
- |} in
4007
+ |} in
4008
4008
OUnit.assert_bool __LOC__ (not @@ Ext_string.is_empty should_err.stderr)
4009
4009
end;
4010
4010
4011
- __LOC__ >:: begin fun _ ->
4011
+ __LOC__ >:: begin fun _ ->
4012
4012
let should_err = bsc_check_eval {|
4013
4013
external mk : int -> ([`a|`b] ) = "" [@@bs.val]
4014
- |} in
4014
+ |} in
4015
4015
OUnit.assert_bool __LOC__ ( Ext_string.is_empty should_err.stderr)
4016
- (* give a warning or ?
4017
- ( [`a | `b ] [@bs.string] )
4016
+ (* give a warning or ?
4017
+ ( [`a | `b ] [@bs.string] )
4018
4018
(* auto-convert to ocaml poly-variant *)
4019
4019
*)
4020
4020
end;
4021
4021
4022
- __LOC__ >:: begin fun _ ->
4022
+ __LOC__ >:: begin fun _ ->
4023
4023
let should_err = bsc_check_eval {|
4024
- type t
4024
+ type t
4025
4025
external mk : int -> (_ [@bs.as {json| { x : 3 } |json}]) -> t = "" [@@bs.val]
4026
- |} in
4026
+ |} in
4027
4027
OUnit.assert_bool __LOC__ (Ext_string.contain_substring should_err.stderr "Invalid json literal")
4028
4028
end
4029
4029
;
4030
- __LOC__ >:: begin fun _ ->
4030
+ __LOC__ >:: begin fun _ ->
4031
4031
let should_err = bsc_check_eval {|
4032
- type t
4032
+ type t
4033
4033
external mk : int -> (_ [@bs.as {json| { "x" : 3 } |json}]) -> t = "" [@@bs.val]
4034
- |} in
4034
+ |} in
4035
4035
OUnit.assert_bool __LOC__ (Ext_string.is_empty should_err.stderr)
4036
4036
end
4037
4037
;
4038
4038
(* #1510 *)
4039
- __LOC__ >:: begin fun _ ->
4039
+ __LOC__ >:: begin fun _ ->
4040
4040
let should_err = bsc_check_eval {|
4041
- let should_fail = fun [@bs.this] (Some x) y u -> y + u
4042
- |} in
4043
- OUnit.assert_bool __LOC__
4041
+ let should_fail = fun [@bs.this] (Some x) y u -> y + u
4042
+ |} in
4043
+ OUnit.assert_bool __LOC__
4044
4044
(Ext_string.contain_substring should_err.stderr "simple")
4045
4045
end;
4046
4046
4047
- __LOC__ >:: begin fun _ ->
4047
+ __LOC__ >:: begin fun _ ->
4048
4048
let should_err = bsc_check_eval {|
4049
- let should_fail = fun [@bs.this] (Some x as v) y u -> y + u
4050
- |} in
4049
+ let should_fail = fun [@bs.this] (Some x as v) y u -> y + u
4050
+ |} in
4051
4051
(* Ounit_cmd_util.debug_output should_err; *)
4052
- OUnit.assert_bool __LOC__
4052
+ OUnit.assert_bool __LOC__
4053
4053
(Ext_string.contain_substring should_err.stderr "simple")
4054
4054
end;
4055
4055
4056
- __LOC__ >:: begin fun _ ->
4056
+ (* __LOC__ >:: begin fun _ ->
4057
4057
let should_err = bsc_check_eval {|
4058
4058
external f : string -> unit -> unit = "x.y" [@@bs.send]
4059
- |} in
4060
- OUnit.assert_bool __LOC__
4059
+ |} in
4060
+ OUnit.assert_bool __LOC__
4061
4061
(Ext_string.contain_substring should_err.stderr "Not a valid method name")
4062
- end;
4062
+ end; *)
4063
4063
4064
4064
4065
4065
@@ -4103,50 +4103,50 @@ external ff :
4103
4103
(not (Ext_string.is_empty should_err.stderr))
4104
4104
4105
4105
end;
4106
- __LOC__ >:: begin fun _ ->
4106
+ __LOC__ >:: begin fun _ ->
4107
4107
let should_err = bsc_check_eval {|
4108
4108
external foo_bar :
4109
4109
(_ [@bs.as "foo"]) ->
4110
4110
string ->
4111
4111
string = "bar"
4112
4112
[@@bs.send]
4113
- |} in
4114
- OUnit.assert_bool __LOC__
4113
+ |} in
4114
+ OUnit.assert_bool __LOC__
4115
4115
(Ext_string.contain_substring should_err.stderr "Ill defined attribute")
4116
4116
end;
4117
- __LOC__ >:: begin fun _ ->
4117
+ __LOC__ >:: begin fun _ ->
4118
4118
let should_err = bsc_check_eval {|
4119
4119
let bla4 foo x y = foo##(method1 x y [@bs])
4120
- |} in
4120
+ |} in
4121
4121
(* Ounit_cmd_util.debug_output should_err ; *)
4122
- OUnit.assert_bool __LOC__
4122
+ OUnit.assert_bool __LOC__
4123
4123
(Ext_string.contain_substring should_err.stderr
4124
4124
"Unused")
4125
4125
end;
4126
- __LOC__ >:: begin fun _ ->
4126
+ __LOC__ >:: begin fun _ ->
4127
4127
let should_err = bsc_check_eval {|
4128
- external mk : int ->
4128
+ external mk : int ->
4129
4129
(
4130
- [`a|`b]
4131
- [@bs.string]
4132
- ) = "" [@@bs.val]
4133
- |} in
4130
+ [`a|`b]
4131
+ [@bs.string]
4132
+ ) = "" [@@bs.val]
4133
+ |} in
4134
4134
(* Ounit_cmd_util.debug_output should_err ; *)
4135
- OUnit.assert_bool __LOC__
4135
+ OUnit.assert_bool __LOC__
4136
4136
(Ext_string.contain_substring should_err.stderr
4137
4137
"Unused")
4138
4138
end;
4139
- __LOC__ >:: begin fun _ ->
4139
+ __LOC__ >:: begin fun _ ->
4140
4140
let should_err = bsc_check_eval {|
4141
4141
type -'a t = {k : 'a } [@@bs.deriving abstract]
4142
- |} in
4142
+ |} in
4143
4143
OUnit.assert_bool __LOC__
4144
4144
(Ext_string.contain_substring should_err.stderr "contravariant")
4145
4145
end;
4146
- __LOC__ >:: begin fun _ ->
4146
+ __LOC__ >:: begin fun _ ->
4147
4147
let should_err = bsc_check_eval {|
4148
4148
type 'a t = {k : int -> 'a } [@@bs.deriving abstract]
4149
- |} in
4149
+ |} in
4150
4150
OUnit.assert_bool __LOC__
4151
4151
(Ext_string.contain_substring should_err.stderr "not allowed")
4152
4152
end
0 commit comments