Better handling of flush, short lines

This commit is contained in:
Carlos Martín Nieto
2013-05-28 17:57:45 +02:00
parent ecb7cdfc23
commit 75e3d5416c
2 changed files with 40 additions and 22 deletions

View File

@@ -4,7 +4,9 @@
-include("src/geef_records.hrl").
flush_test() ->
geef_pkt:parse("0000").
Expected = {flush, <<>>},
Actual = geef_pkt:parse("0000"),
?assertEqual(Expected, Actual).
have_test() ->
Expected = {{want, geef_oid:parse("e17ca7f2d877acbf8b9a9a1cb4c243ca72e86463")}, <<>>},
@@ -14,5 +16,11 @@ have_test() ->
request_test() ->
Line = <<"0039git-upload-pack /schacon/gitbook.git\0host=example.com\0">>,
Expected = #geef_request{service=upload_pack, path= <<"/schacon/gitbook.git">>, host= <<"example.com">>},
{ok, Actual} = geef_pkt:parse_request(Line),
?assertEqual(Expected, Actual).
short_test() ->
Line = <<"0039git-upload">>,
Expected = {error, ebufs},
Actual = geef_pkt:parse_request(Line),
?assertEqual(Expected, Actual).