コード例 #1
0
        public virtual void TestGetText_DiffCc()
        {
            Encoding csOld = Sharpen.Extensions.GetEncoding("ISO-8859-1");
            Encoding csNew = Sharpen.Extensions.GetEncoding("UTF-8");

            NGit.Patch.Patch p = ParseTestPatchFile();
            NUnit.Framework.Assert.IsTrue(p.GetErrors().IsEmpty());
            NUnit.Framework.Assert.AreEqual(1, p.GetFiles().Count);
            CombinedFileHeader fh = (CombinedFileHeader)p.GetFiles()[0];

            NUnit.Framework.Assert.AreEqual(1, fh.GetHunks().Count
                                            );
            // Read the original file as ISO-8859-1 and fix up the one place
            // where we changed the character encoding. That makes the exp
            // string match what we really expect to get back.
            //
            string exp = ReadTestPatchFile(csOld);

            exp = exp.Replace("\x12f\xcdngstr\x12f\x10am", "\u00c5ngstr\u00f6m");
            NUnit.Framework.Assert.AreEqual(exp, fh.GetScriptText(new Encoding[] { csNew, csOld
                                                                                   , csNew }));
        }