Exemplo n.º 1
0
        public static void CompareTrees(string expected, AstRoot actualTree)
        {
            AstWriter astWriter = new AstWriter();
            string actual = astWriter.WriteTree(actualTree);
            
            string expectedLine, actualLine;
            int index;
            int result = BaselineCompare.CompareLines(expected, actual, out expectedLine, out actualLine, out index);

            result.Should().Be(0, "Line at {0} should be {1}, but found {2}, different at position {3}", result, expectedLine, actualLine, index);
        }
Exemplo n.º 2
0
        private static void ParseFileImplementation(CoreTestFilesFixture fixture, string name) {
            string testFile = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".tree";
            string text = fixture.LoadDestinationFile(name);

            AstRoot actualTree = RParser.Parse(text);

            AstWriter astWriter = new AstWriter();
            string actual = astWriter.WriteTree(actualTree);

            if (_regenerateBaselineFiles) {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, name) + ".tree";
                TestFiles.UpdateBaseline(baselineFile, actual);
            } else {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Exemplo n.º 3
0
 public string WriteTree() {
     AstWriter writer = new AstWriter();
     return writer.WriteTree(this);
 }