-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
738b067
commit 5723020
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(in-package :cl-amqp.test) | ||
|
||
(enable-binary-string-syntax) | ||
|
||
(plan 1) | ||
|
||
(subtest "Methods to/from frames" | ||
(subtest "Methods to frames" | ||
(subtest "Content method with content" | ||
(let* ((method (make-instance 'amqp-method-basic-publish :exchange "qwe" | ||
:content #b"Hello World!")) | ||
(frames | ||
(method-to-frames method 1 14))) | ||
(is (length frames) 5 "Five frames") | ||
|
||
(is-type (first frames) 'method-frame) | ||
(is (frame-channel (first frames)) 1) | ||
(is-type (second frames) 'header-frame) | ||
(is (frame-channel (second frames)) 1) | ||
|
||
(is-type (third frames) 'body-frame) | ||
(is (frame-payload (third frames)) #b"Hello" :test #'equalp) | ||
(is (frame-channel (third frames)) 1) | ||
|
||
(is-type (fourth frames) 'body-frame) | ||
(is (frame-payload (fourth frames)) #b" Worl" :test #'equalp) | ||
(is (frame-channel (fourth frames)) 1) | ||
|
||
(is-type (fifth frames) 'body-frame) | ||
(is (frame-payload (fifth frames)) #b"d!" :test #'equalp) | ||
(is (frame-channel (fifth frames)) 1))) | ||
|
||
(subtest "Content method without content" | ||
(let* ((method (make-instance 'amqp-method-basic-publish :exchange "qwe")) | ||
(frames | ||
(method-to-frames method 2 14))) | ||
(is (length frames) 2 "Five frames") | ||
|
||
(is-type (first frames) 'method-frame) | ||
(is (frame-channel (first frames)) 2) | ||
(is-type (second frames) 'header-frame) | ||
(is (frame-channel (second frames)) 2))) | ||
|
||
(subtest "Non-content method" | ||
(let* ((method (make-instance 'amqp-method-queue-declare :queue "qwe")) | ||
(frames | ||
(method-to-frames method 2 14))) | ||
(is (length frames) 1 "Single frame") | ||
|
||
(is-type (first frames) 'method-frame) | ||
(is (frame-channel (first frames)) 2))))) | ||
|
||
(finalize) |