diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2020-11-30 13:02:18 +0100 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2020-11-30 13:02:18 +0100 |
commit | c053b510b3b921c5859a69bc74b98bcdec9c2a17 (patch) | |
tree | 19f81ecccafcd58977d9be3b8071eed460eea6af /org.eclipse.jgit.test/tst/org | |
parent | 4f30dc5eb95dad3eb898a71c7b864fc190ce4ef8 (diff) | |
download | jgit-c053b510b3b921c5859a69bc74b98bcdec9c2a17.tar.gz jgit-c053b510b3b921c5859a69bc74b98bcdec9c2a17.zip |
PacketLineInTest: test for END and DELIM being distinguishable
Explicitly test that END and DELIM can be distinguished. If not, the
wire protocol V2 breaks down.
Bug: 568950
Change-Id: I5f3496168244303c68893f1c756831dd27440aeb
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java index 5d7f881ab9..7f03357e9c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java @@ -12,8 +12,8 @@ package org.eclipse.jgit.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; @@ -111,20 +111,25 @@ public class PacketLineInTest { final String act = in.readString(); assertEquals("", act); assertFalse(PacketLineIn.isEnd(act)); + assertFalse(PacketLineIn.isDelimiter(act)); assertEOF(); } @Test public void testReadString_End() throws IOException { init("0000"); - assertTrue(PacketLineIn.isEnd(in.readString())); + String act = in.readString(); + assertTrue(PacketLineIn.isEnd(act)); + assertFalse(PacketLineIn.isDelimiter(act)); assertEOF(); } @Test public void testReadString_Delim() throws IOException { init("0001"); - assertTrue(PacketLineIn.isDelimiter(in.readString())); + String act = in.readString(); + assertTrue(PacketLineIn.isDelimiter(act)); + assertFalse(PacketLineIn.isEnd(act)); assertEOF(); } |