From 5d4a3616a978c60d1589bf35cd43c64c4f6778ac Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Tue, 24 Mar 2015 11:28:48 +0000 Subject: [PATCH] Add test for sending/receiving a message --- CHANGELOG.md | 4 ++++ module.l | 2 +- test/test_nanomsg.l | 21 ++++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ec032e..6ece151 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.5.20 (2014-03-24) + + * Add test for sending/receiving messages + ## 0.5.19 (2014-03-24) * Swap order of module.l loading diff --git a/module.l b/module.l index 92d2cdd..9fbeccd 100644 --- a/module.l +++ b/module.l @@ -1,6 +1,6 @@ [de MODULE_INFO ("name" "nanomsg") - ("version" "0.5.19") + ("version" "0.5.20") ("summary" "Nanomsg ffi-binding for PicoLisp") ("source" "https://github.com/aw/picolisp-nanomsg.git") ("author" "Alexander Williams") diff --git a/test/test_nanomsg.l b/test/test_nanomsg.l index d8545ca..1cdc1bf 100644 --- a/test/test_nanomsg.l +++ b/test/test_nanomsg.l @@ -102,6 +102,24 @@ (end-sock Sockpair) Result ] +[de test-send-recv () + # Fork the sender and let it block until sent + (unless (fork) + (let Sockpair + (pair-bind "tcp://127.0.0.1:5561") + (msg-send (car Sockpair) "Hello World!") + (end-sock Sockpair) ) + (bye) ) + + # Receive the message + (let (Sockpair (pair-connect "tcp://127.0.0.1:5561") + Result (msg-recv (car Sockpair))) + (end-sock Sockpair) + + (unit~assert-equal "Hello World!" + Result + "Successfully send/receive a message using PAIR protocol" ] + [unit~execute '(unit~assert-throws 'InternalError '(NanomsgError . "Protocol not supported") @@ -119,4 +137,5 @@ '(test-pull-bind) '(test-push-connect) '(test-survey-bind) - '(test-respond-connect) ] + '(test-respond-connect) + '(test-send-recv) ]