Skip to content

Commit a58c98d

Browse files
committed
Tweak tests
1 parent 8c10805 commit a58c98d

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/proto.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ SEXP rnng_protocol_open(SEXP protocol, SEXP dial, SEXP listen, SEXP tls, SEXP au
117117
}
118118

119119
if (xc)
120-
goto fail;
120+
goto failmem;
121121

122122
PROTECT(socket = R_MakeExternalPtr(sock, nano_SocketSymbol, R_NilValue));
123123
R_RegisterCFinalizerEx(socket, socket_finalizer, TRUE);
@@ -144,9 +144,8 @@ SEXP rnng_protocol_open(SEXP protocol, SEXP dial, SEXP listen, SEXP tls, SEXP au
144144
UNPROTECT(1);
145145
return socket;
146146

147-
fail:
148-
free(sock);
149147
failmem:
148+
free(sock);
150149
ERROR_OUT(xc);
151150

152151
}

src/sync.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,10 @@ SEXP rnng_monitor_create(SEXP socket, SEXP cv) {
637637
nng_socket *sock = (nng_socket *) NANO_PTR(socket);
638638

639639
if ((xc = nng_pipe_notify(*sock, NNG_PIPE_EV_ADD_POST, pipe_cb_monitor, monitor)))
640-
goto fail;
640+
goto failmem;
641641

642642
if ((xc = nng_pipe_notify(*sock, NNG_PIPE_EV_REM_POST, pipe_cb_monitor, monitor)))
643-
goto fail;
643+
goto failmem;
644644

645645
PROTECT(xptr = R_MakeExternalPtr(monitor, nano_MonitorSymbol, R_NilValue));
646646
R_RegisterCFinalizerEx(xptr, monitor_finalizer, TRUE);
@@ -650,7 +650,6 @@ SEXP rnng_monitor_create(SEXP socket, SEXP cv) {
650650

651651
return xptr;
652652

653-
fail:
654653
failmem:
655654
if (monitor != NULL)
656655
free(monitor->ids);

tests/tests.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ test_error(stream(), "specify a URL")
481481

482482
test_type("character", ver <- nng_version())
483483
test_equal(length(ver), 2L)
484-
test_equal(nng_error(8L), "8 | Try again")
484+
test_equal(nng_error(5L), "5 | Timed out")
485+
test_equal(nng_error(8), "8 | Try again")
485486
test_true(is_nul_byte(as.raw(0L)))
486487
test_true(!is_nul_byte(NULL))
487488
test_true(!is_error_value(1L))

0 commit comments

Comments
 (0)