[log] Remove tests on the CommitParser, because it is a test-only parser

This commit is contained in:
Kirill Likhodedov
2013-09-28 16:14:03 +04:00
parent 2387dc6ab1
commit 9c50041284
3 changed files with 0 additions and 175 deletions
@@ -1,67 +0,0 @@
package com.intellij.vcs.log.parser;
import com.intellij.vcs.log.VcsShortCommitDetails;
import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* @author erokhins
*/
public class CommitDataParserTest {
private static String toStr(@NotNull VcsShortCommitDetails commitData) {
StringBuilder s = new StringBuilder();
s.append(commitData.getHash()).append("|-");
s.append(commitData.getAuthorName()).append("|-");
s.append(commitData.getAuthorTime()).append("|-");
s.append(commitData.getSubject());
return s.toString();
}
private void runTest(@NotNull String inputStr) {
VcsShortCommitDetails commitData = CommitParser.parseCommitData(inputStr);
assertEquals(inputStr, toStr(commitData));
}
@Test
public void simple1() {
runTest("af56|-author|-1435|-message");
}
@Test
public void emptyMessage() {
runTest("12|-author|-1435|-");
}
@Test
public void longAuthor() {
runTest("af56|-author skdhfb j 2353246|-1435|-message");
}
@Test
public void strangeMessage() {
runTest("af56|-author |-1435|-m|-|-es dfsage");
}
@Test
public void bigTimestamp() {
runTest("af56|-author |-143523623|-m|-|-es dfsage");
}
@Test
public void emptyAuthor() {
runTest("af56|-|-143523623|-");
}
@Test
public void emptyTimestamp() {
VcsShortCommitDetails commitData = CommitParser.parseCommitData("af56|-author |-|-message");
Assert.assertEquals("author ", commitData.getAuthorName());
Assert.assertEquals(0, commitData.getAuthorTime());
Assert.assertEquals("message", commitData.getSubject());
}
}
@@ -1,53 +0,0 @@
package com.intellij.vcs.log.parser;
import com.intellij.vcs.log.Hash;
import com.intellij.vcs.log.VcsCommit;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* @author erokhins
*/
public class CommitParserTest {
private String toStr(VcsCommit commitParentHashes) {
StringBuilder s = new StringBuilder();
s.append(commitParentHashes.getHash().asString()).append("|-");
for (int i = 0; i < commitParentHashes.getParents().size(); i++) {
Hash hash = commitParentHashes.getParents().get(i);
if (i != 0) {
s.append(" ");
}
s.append(hash.asString());
}
return s.toString();
}
private void runTest(String inputStr) {
VcsCommit vcsCommit = CommitParser.parseCommitParents(inputStr);
assertEquals(inputStr, toStr(vcsCommit));
}
@Test
public void simple1() {
runTest("a312|-");
}
@Test
public void parent() {
runTest("a312|-23");
}
@Test
public void twoParent() {
runTest("a312|-23 a54");
}
@Test
public void moreParent() {
runTest("a312|-23 a54 abcdef34 034f 00af 00000");
}
}
@@ -1,55 +0,0 @@
package com.intellij.vcs.log.parser;
import com.intellij.vcs.log.Hash;
import com.intellij.vcs.log.TimedVcsCommit;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* @author erokhins
*/
public class TimestampVcsCommitParserTest {
private String toStr(TimedVcsCommit commitParents) {
StringBuilder s = new StringBuilder();
s.append(commitParents.getAuthorTime()).append("|-");
s.append(commitParents.getHash().asString()).append("|-");
for (int i = 0; i < commitParents.getParents().size(); i++) {
Hash hash = commitParents.getParents().get(i);
if (i != 0) {
s.append(" ");
}
s.append(hash.asString());
}
return s.toString();
}
private void runTest(String inputStr) {
TimedVcsCommit commitParents = CommitParser.parseTimestampParentHashes(inputStr);
assertEquals(inputStr, toStr(commitParents));
}
@Test
public void simple() {
runTest("1|-af|-");
}
@Test
public void parents() {
runTest("12314|-af|-12 fd");
}
@Test
public void parent() {
runTest("12314|-af|-12");
}
@Test
public void longTest() {
runTest("123142412423412|-af|-12");
}
}