]> gitweb.factorcode.org Git - factor.git/blob - extra/redis/response-parser/response-parser-tests.factor
bde36114c3bd9a6852bb4ffc6c8be225ac6aa207
[factor.git] / extra / redis / response-parser / response-parser-tests.factor
1 ! Copyright (C) 2009 Bruno Deferrari
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test redis.response-parser io.streams.string ;
4 IN: redis.response-parser.tests
5
6 [ 1 ] [ ":1\r\n" [ read-response ] with-string-reader ] unit-test
7
8 [ "hello" ] [ "$5\r\nhello\r\n" [ read-response ] with-string-reader ] unit-test
9
10 [ f ] [ "$-1\r\n" [ read-response ] with-string-reader ] unit-test
11
12 [ { "hello" "world!" } ] [
13     "*2\r\n$5\r\nhello\r\n$6\r\nworld!\r\n" [ read-response ] with-string-reader
14 ] unit-test
15
16 [ { "hello" f "world!" } ] [
17     "*3\r\n$5\r\nhello\r\n$-1\r\n$6\r\nworld!\r\n" [
18         read-response
19     ] with-string-reader
20 ] unit-test