Exemple #1
0
        private static void FormatFileImplementation(CoreTestFilesFixture fixture, string name, RFormatOptions options) {
            string testFile = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".formatted";
            string text = fixture.LoadDestinationFile(name);

            RFormatter formatter = new RFormatter(options);

            string actual = formatter.Format(text);
            if (_regenerateBaselineFiles) {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, @"Formatting\", Path.GetFileName(testFile)) + ".formatted";
                TestFiles.UpdateBaseline(baselineFile, actual);
            } else {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Exemple #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);
            }
        }
Exemple #3
0
        public static void TokenizeFileImplementation(CoreTestFilesFixture fixture, string name) {
            string testFile = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".tokens";
            string text = fixture.LoadDestinationFile(name);

            ITextProvider textProvider = new TextStream(text);
            var tokenizer = new RTokenizer();

            var tokens = tokenizer.Tokenize(textProvider, 0, textProvider.Length);
            string actual = DebugWriter.WriteTokens<RToken, RTokenType>(tokens);

            if (_regenerateBaselineFiles) {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, @"Tokenization\", Path.GetFileName(testFile)) + ".tokens";
                TestFiles.UpdateBaseline(baselineFile, actual);
            } else {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
 public FormatSamplesFilesTest(CoreTestFilesFixture files) {
     _files = files;
 }
 public TokenizeRSampleFilesTest(CoreTestFilesFixture files) {
     _files = files;
 }
Exemple #6
0
 public static void FormatFile(CoreTestFilesFixture fixture, string name, RFormatOptions options) {
     Action a = () => FormatFileImplementation(fixture, name, options);
     a.ShouldNotThrow();
 }
 public ParseFilesTest(CoreTestFilesFixture files) {
     _files = files;
 }
Exemple #8
0
 public static void TokenizeFile(CoreTestFilesFixture fixture, string name) {
     Action a = () => TokenizeFileImplementation(fixture, name);
     a.ShouldNotThrow();
 }
 public static void FormatFile(CoreTestFilesFixture fixture, string name) {
     FormatFile(fixture, name, new RFormatOptions());
 }
 public TokenizeExpressionsTest(CoreTestFilesFixture files) {
     _files = files;
 }