Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public void testNoFooters_ShortBodyNoLF()
        {
            RevCommit          commit  = Parse("subject\n\nbody of commit");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(0, footers.Count);
        }
Ejemplo n.º 3
0
        public void testNoFooters_OneLineBodyWithLF()
        {
            RevCommit          commit  = Parse("this is a commit\n");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(0, footers.Count);
        }
Ejemplo n.º 4
0
        public void testNoFooters_NewlineOnlyBody5()
        {
            RevCommit          commit  = Parse("\n\n\n\n\n");
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(0, footers.Count);
        }
Ejemplo n.º 5
0
        public void testNoFooters_EmptyBody()
        {
            RevCommit          commit  = Parse(string.Empty);
            IList <FooterLine> footers = commit.GetFooterLines();

            Assert.IsNotNull(footers);
            Assert.AreEqual(0, footers.Count);
        }
Ejemplo n.º 6
0
        public 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");
            IList <string> footers = commit.GetFooterLines("signed-off-by");

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

            Assert.AreEqual("A. U. Thor <*****@*****.**>", footers[0]);
            Assert.AreEqual("Main Tain Er <*****@*****.**>", footers[1]);
        }
Ejemplo n.º 7
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());
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
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());
        }
Ejemplo n.º 10
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());
        }
Ejemplo n.º 11
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());
        }