示例#1
0
        public 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");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(4, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("Signed-off-by", f.Key);
            Assert.AreEqual("A. U. Thor <*****@*****.**>", f.Value);

            f = footers[1];
            Assert.AreEqual("CC", f.Key);
            Assert.AreEqual("<*****@*****.**>", f.Value);

            f = footers[2];
            Assert.AreEqual("Acked-by", f.Key);
            Assert.AreEqual("Some Reviewer <*****@*****.**>", f.Value);

            f = footers[3];
            Assert.AreEqual("Signed-off-by", f.Key);
            Assert.AreEqual("Main Tain Er <*****@*****.**>", f.Value);
        }
示例#2
0
        public void testNotEmail()
        {
            RevCommit          commit  = Parse("subject\n\nbody of commit\n" + "\n" + "Acked-by: Main Tain Er\n");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(1, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("Acked-by", f.Key);
            Assert.AreEqual("Main Tain Er", f.Value);
            Assert.IsNull(f.getEmailAddress());
        }
示例#3
0
        public void testShortKey()
        {
            RevCommit          commit  = Parse("subject\n\nbody of commit\n" + "\n" + "K:V\n");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(1, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("K", f.Key);
            Assert.AreEqual("V", f.Value);
            Assert.IsNull(f.getEmailAddress());
        }
示例#4
0
        public void testEmptyValueWithLF()
        {
            RevCommit          commit  = Parse("subject\n\nbody of commit\n" + "\n" + "Signed-off-by:\n");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(1, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("Signed-off-by", f.Key);
            Assert.AreEqual(string.Empty, f.Value);
            Assert.IsNull(f.getEmailAddress());
        }
示例#5
0
        public 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();

            Assert.IsNotNull(footers);
            Assert.AreEqual(1, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("Signed-off-by", f.Key);
            Assert.AreEqual("A. U. Thor <*****@*****.**>", f.Value);
            Assert.AreEqual("*****@*****.**", f.getEmailAddress());
        }
示例#6
0
        public 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();

            Assert.IsNotNull(footers);
            Assert.AreEqual(1, footers.Count);

            FooterLine f = footers[0];

            Assert.AreEqual("Signed-off-by", f.Key);
            Assert.AreEqual("A. U. Thor <*****@*****.**>  ", f.Value);
            Assert.AreEqual("*****@*****.**", f.getEmailAddress());
        }