0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 07:31:03 +08:00

Problem: no test for (invalid) empty abstract ipc endpoint name

Solution: add test
This commit is contained in:
Simon Giesecke 2020-09-05 13:10:59 +02:00
parent 04ac547c20
commit 90d5cf29d8

View File

@ -35,6 +35,7 @@
SETUP_TEARDOWN_TESTCONTEXT SETUP_TEARDOWN_TESTCONTEXT
static const char test_endpoint[] = "ipc://@tmp-tester"; static const char test_endpoint[] = "ipc://@tmp-tester";
static const char test_endpoint_empty[] = "ipc://@";
void test_roundtrip () void test_roundtrip ()
{ {
@ -56,11 +57,20 @@ void test_roundtrip ()
test_context_socket_close (sb); test_context_socket_close (sb);
} }
void test_empty_abstract_name ()
{
void *sb = test_context_socket (ZMQ_DEALER);
TEST_ASSERT_FAILURE_ERRNO (EINVAL, zmq_bind (sb, test_endpoint_empty));
test_context_socket_close (sb);
}
int main (void) int main (void)
{ {
setup_test_environment (); setup_test_environment ();
UNITY_BEGIN (); UNITY_BEGIN ();
RUN_TEST (test_roundtrip); RUN_TEST (test_roundtrip);
RUN_TEST (test_empty_abstract_name);
return UNITY_END (); return UNITY_END ();
} }