public virtual void TestSignedOffBy_SkipNonFooter() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "Not-A-Footer-Line: this line must not be read as a footer\n" + "\n" + "Signed-off-by: A. U. Thor <*****@*****.**>\n" + "CC: <*****@*****.**>\n" + "not really a footer line but we'll skip it anyway\n" + "Acked-by: Some Reviewer <*****@*****.**>\n" + "Signed-off-by: Main Tain Er <*****@*****.**>\n"); // paragraph break, now footers appear in final block IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(4, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("Signed-off-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("A. U. Thor <*****@*****.**>", f.GetValue()); f = footers[1]; NUnit.Framework.Assert.AreEqual("CC", f.GetKey()); NUnit.Framework.Assert.AreEqual("<*****@*****.**>", f.GetValue()); f = footers[2]; NUnit.Framework.Assert.AreEqual("Acked-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("Some Reviewer <*****@*****.**>", f.GetValue()); f = footers[3]; NUnit.Framework.Assert.AreEqual("Signed-off-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("Main Tain Er <*****@*****.**>", f.GetValue()); }
public virtual void TestNoFooters_OneLineBodyWithLF() { RevCommit commit = Parse("this is a commit\n"); IList <FooterLine> footers = commit.GetFooterLines(); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(0, footers.Count); }
public virtual void TestNoFooters_NewlineOnlyBody5() { RevCommit commit = Parse("\n\n\n\n\n"); IList <FooterLine> footers = commit.GetFooterLines(); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(0, footers.Count); }
public virtual void TestNoFooters_EmptyBody() { RevCommit commit = Parse(string.Empty); IList <FooterLine> footers = commit.GetFooterLines(); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(0, footers.Count); }
public virtual void TestNoFooters_ShortBodyWithLF() { RevCommit commit = Parse("subject\n\nbody of commit\n"); IList <FooterLine> footers = commit.GetFooterLines(); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(0, footers.Count); }
public virtual void TestShortKey() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "\n" + "K:V\n"); IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("K", f.GetKey()); NUnit.Framework.Assert.AreEqual("V", f.GetValue()); NUnit.Framework.Assert.IsNull(f.GetEmailAddress()); }
public virtual void TestEmptyValueNoLF() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "\n" + "Signed-off-by:"); IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("Signed-off-by", f.GetKey()); NUnit.Framework.Assert.AreEqual(string.Empty, f.GetValue()); NUnit.Framework.Assert.IsNull(f.GetEmailAddress()); }
public virtual void TestFilterFootersIgnoreCase() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "Not-A-Footer-Line: this line must not be read as a footer\n" + "\n" + "Signed-Off-By: A. U. Thor <*****@*****.**>\n" + "CC: <*****@*****.**>\n" + "Acked-by: Some Reviewer <*****@*****.**>\n" + "signed-off-by: Main Tain Er <*****@*****.**>\n" ); // paragraph break, now footers appear in final block IList <string> footers = commit.GetFooterLines("signed-off-by"); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(2, footers.Count); NUnit.Framework.Assert.AreEqual("A. U. Thor <*****@*****.**>", footers[0]); NUnit.Framework.Assert.AreEqual("Main Tain Er <*****@*****.**>", footers[1]); }
public virtual void TestNonDelimtedEmail() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "\n" + "Acked-by: [email protected]\n" ); IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("Acked-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("*****@*****.**", f.GetValue()); NUnit.Framework.Assert.AreEqual("*****@*****.**", f.GetEmailAddress()); }
public virtual void TestSignedOffBy_OneUserWithLF() { RevCommit commit = Parse("subject\n\nbody of commit\n" + "\n" + "Signed-off-by: A. U. Thor <*****@*****.**>\n" ); IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("Signed-off-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("A. U. Thor <*****@*****.**>", f.GetValue()); NUnit.Framework.Assert.AreEqual("*****@*****.**", f.GetEmailAddress()); }
public virtual void TestSignedOffBy_IgnoreWhitespace() { // We only ignore leading whitespace on the value, trailing // is assumed part of the value. // RevCommit commit = Parse("subject\n\nbody of commit\n" + "\n" + "Signed-off-by: A. U. Thor <*****@*****.**> \n" ); IList <FooterLine> footers = commit.GetFooterLines(); FooterLine f; NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); f = footers[0]; NUnit.Framework.Assert.AreEqual("Signed-off-by", f.GetKey()); NUnit.Framework.Assert.AreEqual("A. U. Thor <*****@*****.**> ", f.GetValue()); NUnit.Framework.Assert.AreEqual("*****@*****.**", f.GetEmailAddress()); }
public virtual void TestMatchesBugId() { RevCommit commit = Parse("this is a commit subject for test\n" + "\n" + "Simple-Bug-Id: 42\n" ); // paragraph break, now footers appear in final block IList <FooterLine> footers = commit.GetFooterLines(); NUnit.Framework.Assert.IsNotNull(footers); NUnit.Framework.Assert.AreEqual(1, footers.Count); FooterLine line = footers[0]; NUnit.Framework.Assert.IsNotNull(line); NUnit.Framework.Assert.AreEqual("Simple-Bug-Id", line.GetKey()); NUnit.Framework.Assert.AreEqual("42", line.GetValue()); FooterKey bugid = new FooterKey("Simple-Bug-Id"); NUnit.Framework.Assert.IsTrue(line.Matches(bugid), "matches Simple-Bug-Id"); NUnit.Framework.Assert.IsFalse(line.Matches(FooterKey.SIGNED_OFF_BY), "not Signed-off-by" ); NUnit.Framework.Assert.IsFalse(line.Matches(FooterKey.CC), "not CC"); }