Ejemplo n.º 1
0
        private static void TokenizeFileImplementation <TToken, TTokenType, TTokenizer>(DeployFilesFixture fixture, string name, string language)
            where TTokenizer : ITokenizer <TToken>, new() where TToken : IToken <TTokenType>
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".tokens";

            string        text         = fixture.LoadDestinationFile(name);
            ITextProvider textProvider = new TextStream(text);
            var           tokenizer    = new TTokenizer();

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

            if (_regenerateBaselineFiles)
            {
                // Update this to your actual enlistment if you need to update baseline
                string enlistmentPath = @"F:\RTVS\src\R\Support\Test\" + language + @"\Files\Tokenization";
                baselineFile = Path.Combine(enlistmentPath, Path.GetFileName(testFile)) + ".tokens";

                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Open a disk file in an editor window
        /// </summary>
        /// <param name="fixture"></param>
        /// <param name="fileName">File name</param>
        /// <returns>Editor instance</returns>
        public void OpenFile(DeployFilesFixture fixture, string fileName)
        {
            string content = fixture.LoadDestinationFile(fileName);

            EditorWindow.Create(content, fileName);
        }