Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Add test for sending/receiving a message
Browse files Browse the repository at this point in the history
  • Loading branch information
aw committed Mar 24, 2015
1 parent eb30321 commit 5d4a361
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion module.l
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
21 changes: 20 additions & 1 deletion test/test_nanomsg.l
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -119,4 +137,5 @@
'(test-pull-bind)
'(test-push-connect)
'(test-survey-bind)
'(test-respond-connect) ]
'(test-respond-connect)
'(test-send-recv) ]

0 comments on commit 5d4a361

Please sign in to comment.