示例#1
0
        public void ShouldClassifyVariable()
        {
            var script = "$variable";

            Token[]      tokens;
            ParseError[] errors;
            Parser.ParseInput(script, out tokens, out errors);



            var infos = _classifierService.ClassifyTokens(tokens, 0);

            Assert.AreEqual("variable", infos.ElementAt(0).ClassificationType.Classification);
        }
示例#2
0
        private void ClassifyPowerShellTokensTestHelper(string script, int targetToken, string expectedType)
        {
            Token[]      tokens;
            ParseError[] errors;
            Parser.ParseInput(script, out tokens, out errors);

            var infos = _classifierService.ClassifyTokens(tokens, 0).ToArray();

            var actual = infos[targetToken].ClassificationType.Classification;

            Assert.AreEqual(expectedType, actual, string.Format("{0} classifcation type expected, got {1}.", expectedType, actual));
        }