Пример #1
0
        public void MultipleChangesWithJapanese()
        {
            string input =
                ":000000 100644 0000000000000000000000000000000000000000 ed61b923604692e7c8b14763bd94412f471d91cc A\0TestFiles/試し0.txt\0" +
                ":100644 100644 5f10a5d3fa9f56697881f8d9c49e20bcc541cc94 74e8a9318a5566812366a5b6005c94cfdd33036d M\0TestFiles/試し1.txt\0" +
                ":100644 000000 de4ea28b4e441777cf99329788d54598645618f3 0000000000000000000000000000000000000000 D\0TestFiles/試し2.txt\0" +
                ":100644 100644 fb6422c94fcb11e61378a231b0f3ce36958206d4 fb6422c94fcb11e61378a231b0f3ce36958206d4 R100\0TestFiles/試し3.txt\0TestFiles/試し3_moved.txt\0" +
                ":000000 100644 0000000000000000000000000000000000000000 5238c94b04f81776f57eed406484c0a0e0697749 A\0TestFiles/試し4.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Equal(5, changes.Length);

                Assert.Equal("A", changes[0].Status);
                Assert.Equal("TestFiles/試し0.txt", changes[0].path);

                Assert.Equal("M", changes[1].Status);
                Assert.Equal("TestFiles/試し1.txt", changes[1].path);

                Assert.Equal("D", changes[2].Status);
                Assert.Equal("TestFiles/試し2.txt", changes[2].path);

                Assert.Equal("R", changes[3].Status);
                Assert.Equal("100", changes[3].score);
                Assert.Equal("TestFiles/試し3.txt", changes[3].path);
                Assert.Equal("TestFiles/試し3_moved.txt", changes[3].pathTo);

                Assert.Equal("A", changes[4].Status);
                Assert.Equal("TestFiles/試し4.txt", changes[4].path);
            }
        }
Пример #2
0
        public void ShouldDetectCaseOnlyRenameWithNoContentChange_AndReturnNoChanges()
        {
            string input = ":100644 100644 fb6422c94fcb11e61378a231b0f3ce36958206d4 fb6422c94fcb11e61378a231b0f3ce36958206d4 R100\0TestFiles/Test2.txt\0TestFiles/test2.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Empty(changes);
            }
        }
Пример #3
0
        public void ShouldDetectAddDeleteCorrespondingToCaseRenameWithoutContentChange_AndReturnNoChanges()
        {
            string input =
                ":000000 100644 0000000000000000000000000000000000000000 ed61b923604692e7c8b14763bd94412f471d91cc A\0TestFiles/Test3.txt\0" +
                ":100644 000000 ed61b923604692e7c8b14763bd94412f471d91cc 0000000000000000000000000000000000000000 D\0TestFiles/test3.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Empty(changes);
            }
        }
Пример #4
0
        public void ShouldDetectCaseOnlyRenameWithContentChange_AndReturnOneModificationChanges()
        {
            string input = ":100644 100644 aaaac94fcb11e61378a231b0f3ce36958206d4dd bbbb22c94fcb11e61378a231b0f3ce36958206d4 R100\0TestFiles/Test1.txt\0TestFiles/test1.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Equal(1, changes.Length);

                Assert.Equal("M", changes[0].Status);
                Assert.Equal("TestFiles/Test1.txt", changes[0].path);
            }
        }
Пример #5
0
        public void ShouldDetectNormalRename_AndReturnOneRenameChange()
        {
            string input = ":100644 100644 ab6422c94fcb11e61378a231b0f3ce36958206d4 bb6422c94fcb11e61378a231b0f3ce36958206d4 R100\0TestFiles/Test0.txt\0TestFiles/Test_moved.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Equal(1, changes.Length);

                Assert.Equal("R", changes[0].Status);
                Assert.Equal("TestFiles/Test_moved.txt", changes[0].pathTo);
            }
        }
Пример #6
0
        public void ShouldDetectAddDeleteCorrespondingToCaseRenameWithContentChange_AndReturnOneModificationChange()
        {
            string input =
                ":000000 100644 0000000000000000000000000000000000000000 ed61b923604692e7c8b14763bd94412f471d91cc A\0TestFiles/Test0.txt\0" +
                ":100644 000000 de4ea28b4e441777cf99329788d545986456183f 0000000000000000000000000000000000000000 D\0TestFiles/test0.txt\0";

            using (var reader = new System.IO.StringReader(input))
            {
                var changes = GitChangeInfo.GetChangedFiles(reader).ToArray();

                Assert.Equal(1, changes.Length);

                Assert.Equal("M", changes[0].Status);
                Assert.Equal("TestFiles/Test0.txt", changes[0].path);
            }
        }