Skip to content

Commit

Permalink
Adjust whitespace after preceding commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Dec 26, 2023
1 parent 3b6c67f commit 566d2ad
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
38 changes: 19 additions & 19 deletions test/TTY.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ let with_tty f =

let tests = [
"tty", [
"tty", `Quick, begin fun () ->
with_tty begin fun tty ->
let width, height =
Luv.TTY.get_winsize tty |> check_success_result "get_winsize" in
if width <= 0 then
Alcotest.failf "width <= 0: %i" width;
if height <= 0 then
Alcotest.failf "height <= 0: %i" height
end
end;

(* This is a compilation test. If the type constraints in handle.mli are
wrong, there will be a type error in this test. *)
"handle functions", `Quick, begin fun () ->
with_tty begin fun tty ->
ignore @@ Luv.Handle.fileno tty
end
end;
]
"tty", `Quick, begin fun () ->
with_tty begin fun tty ->
let width, height =
Luv.TTY.get_winsize tty |> check_success_result "get_winsize" in
if width <= 0 then
Alcotest.failf "width <= 0: %i" width;
if height <= 0 then
Alcotest.failf "height <= 0: %i" height
end
end;

(* This is a compilation test. If the type constraints in handle.mli are
wrong, there will be a type error in this test. *)
"handle functions", `Quick, begin fun () ->
with_tty begin fun tty ->
ignore @@ Luv.Handle.fileno tty
end
end;
]
]
64 changes: 32 additions & 32 deletions test/UDP.ml
Original file line number Diff line number Diff line change
Expand Up @@ -163,43 +163,43 @@ let tests = [
end;

"multicast", `Quick, begin fun () ->
let group = "239.0.0.128" in
let group = "239.0.0.128" in

let receiver_finished = ref false in
let sender_finished = ref false in
let receiver_finished = ref false in
let sender_finished = ref false in

with_sender_and_receiver
~receiver_logic:
begin fun receiver ->
Luv.UDP.set_membership
receiver ~group ~interface:"127.0.0.1" `JOIN_GROUP
|> check_success_result "set_membership 1";
with_sender_and_receiver
~receiver_logic:
begin fun receiver ->
Luv.UDP.set_membership
receiver ~group ~interface:"127.0.0.1" `JOIN_GROUP
|> check_success_result "set_membership 1";

expect receiver "foo" begin fun () ->
Luv.Handle.close receiver ignore;
receiver_finished := true
end
expect receiver "foo" begin fun () ->
Luv.Handle.close receiver ignore;
receiver_finished := true
end
~sender_logic:
begin fun sender address ->
let port =
match Luv.Sockaddr.port address with
| Some port -> port
| None -> Alcotest.fail "port"
in
let address =
Luv.Sockaddr.ipv4 group port
|> check_success_result "group address"
in
Luv.UDP.try_send sender [Luv.Buffer.from_string "foo"] address
|> check_success_result "try_send";
Luv.Handle.close sender ignore;
sender_finished := true
end;
end
~sender_logic:
begin fun sender address ->
let port =
match Luv.Sockaddr.port address with
| Some port -> port
| None -> Alcotest.fail "port"
in
let address =
Luv.Sockaddr.ipv4 group port
|> check_success_result "group address"
in
Luv.UDP.try_send sender [Luv.Buffer.from_string "foo"] address
|> check_success_result "try_send";
Luv.Handle.close sender ignore;
sender_finished := true
end;

Alcotest.(check bool) "receiver finished" true !receiver_finished;
Alcotest.(check bool) "sender finished" true !sender_finished
end;
Alcotest.(check bool) "receiver finished" true !receiver_finished;
Alcotest.(check bool) "sender finished" true !sender_finished
end;

(* This is a compilation test. If the type constraints in handle.mli are
wrong, there will be a type error in this test. *)
Expand Down

0 comments on commit 566d2ad

Please sign in to comment.