aboutsummaryrefslogtreecommitdiff
path: root/tests/sock.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-04 12:37:34 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-04 13:13:24 -0700
commit45f455064b5704f3d5ed8ecf9f197a18fe72ee59 (patch)
tree76a626029f3a5a818b113b7e4342efaf6220a03f /tests/sock.c
parent505a9bce029e51540739c853a6c9eef0ecfb2e90 (diff)
downloadnng-45f455064b5704f3d5ed8ecf9f197a18fe72ee59.tar.gz
nng-45f455064b5704f3d5ed8ecf9f197a18fe72ee59.tar.bz2
nng-45f455064b5704f3d5ed8ecf9f197a18fe72ee59.zip
fixes #331 replace NNG_OPT_RAW option with constructor
This makes the raw mode something that is immutable, determined at socket construction. This is an enabling change for the separate context support coming soon. As a result, this is an API breaking change for users of the raw mode option (NNG_OPT_RAW). There aren't many of them out there. Cooked mode is entirely unaffected. There are changes to tests and documentation included.
Diffstat (limited to 'tests/sock.c')
-rw-r--r--tests/sock.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/tests/sock.c b/tests/sock.c
index a5b9bdc1..c4de6ad4 100644
--- a/tests/sock.c
+++ b/tests/sock.c
@@ -128,11 +128,6 @@ TestMain("Socket Operations", {
So(nng_getopt_bool(s1, NNG_OPT_RAW, &raw) ==
0);
So(raw == false);
- So(nng_setopt_bool(s1, NNG_OPT_RAW, true) ==
- 0);
- So(nng_getopt_bool(s1, NNG_OPT_RAW, &raw) ==
- 0);
- So(raw == true);
});
Convey("URL option works", {
@@ -255,16 +250,9 @@ TestMain("Socket Operations", {
sz) == NNG_EINVAL);
});
- Convey("Bogus raw fails", {
- // Bool type is 1 byte.
- So(nng_setopt_int(s1, NNG_OPT_RAW, 42) ==
- NNG_EBADTYPE);
- So(nng_setopt_int(s1, NNG_OPT_RAW, -42) ==
- NNG_EBADTYPE);
- So(nng_setopt_int(s1, NNG_OPT_RAW, 0) ==
- NNG_EBADTYPE);
- So(nng_setopt(s1, NNG_OPT_RAW, "abcd", 4) ==
- NNG_EINVAL);
+ Convey("Cannot set raw", {
+ So(nng_setopt_bool(s1, NNG_OPT_RAW, true) ==
+ NNG_EREADONLY);
});
Convey("Unsupported options fail", {