示例#1
0
        public void Incremental_AddCharEndLine()
        {
            InitUnitTest("AddCharEndLine.tcbl");

            var updateLine = TestChangeEvent.UpdateLine(TextChangeType.LineUpdated, 3, "       DATA DIVISION.C");

            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(updateLine);

            CompareTextDocuments();
        }
示例#2
0
        public void Incremental_DeleteCharEndLine()
        {
            InitUnitTest("DeleteCharEndLine.tcbl");

            var changes = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "");

            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 3, "       DATA DIVISION").TextChanges[0]);

            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(changes);

            CompareTextDocuments();
        }
示例#3
0
        public void Incremental_SupprEndLineEmptyLine()
        {
            InitUnitTest("SupprEndLineEmptyLine.tcbl");

            var changes = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 1, "");

            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 1, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 1, "       PROGRAM-ID. ProcCall.").TextChanges[0]);

            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(changes);

            CompareTextDocuments();
        }
示例#4
0
        public void Incremental_AddLineJumpMiddleLine()
        {
            InitUnitTest("AddLineJumpMiddleLine.tcbl");

            var lineJumpChanges = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "");

            lineJumpChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 3, "       DATA        ").TextChanges[0]);
            lineJumpChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 4, "       DIVISION.").TextChanges[0]);

            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(lineJumpChanges);

            CompareTextDocuments();
        }
示例#5
0
        public void Incremental_AddMultipleLines()
        {
            InitUnitTest("AddMultipleLines.tcbl");

            var changes = TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 6, "       01 mytest     TYPE BOOL.");

            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 7, "       01 myzef TYPE DATE.").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 8, "       01 zfzef TYPE BOOL.").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 9, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 10, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 11, "       01 fzef TYPE CountryISO2.").TextChanges[0]);


            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(changes);

            CompareTextDocuments();
        }
示例#6
0
        public void Incremental_DeleteMultipleLines()
        {
            InitUnitTest("DeleteMultipleLines.tcbl");

            var changes = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "");

            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 5, "").TextChanges[0]);
            changes.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 5, "       01 W-TechCTX TYPE TechnicalContext.").TextChanges[0]);

            //Update text document
            UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(changes);

            CompareTextDocuments();
        }
示例#7
0
        public void Check_TextLineChange()
        {
            InitUnitTest("TextLineIncremental.tcbl");

            //Get existing result files
            var names = UnitTest.Comparator.paths.Resultnames as Multipass.IndexNames;

            if (names != null)
            {
                names.index = 0;
                //Delete multiple lines
                var firstChanges = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "");
                firstChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "").TextChanges[0]);
                firstChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "").TextChanges[0]);
                firstChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "").TextChanges[0]);
                firstChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "").TextChanges[0]);
                firstChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 3, "").TextChanges[0]);

                //Update text document
                UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(firstChanges);
                //Compare
                CompareTextDocuments();

                //Simulate a Ctrl+Z
                var secondChanges = TestChangeEvent.UpdateLine(TextChangeType.LineRemoved, 3, "");
                secondChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 3, "       DATA DIVISION.").TextChanges[0]);
                secondChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 4, "       WORKING-STORAGE SECTION.").TextChanges[0]);
                secondChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 5, "       01 W-TechCTX TYPE TechnicalContext.").TextChanges[0]);
                secondChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 6, "       01 mytest     TYPE BOOL.").TextChanges[0]);
                secondChanges.TextChanges.Add(TestChangeEvent.UpdateLine(TextChangeType.LineInserted, 7, "       01 myzef TYPE DATE.").TextChanges[0]);

                //Update text document
                UnitTest.Compiler.CompilationResultsForProgram.UpdateTextLines(secondChanges);
                //Compare
                names.index++;
                CompareTextDocuments();
            }
        }