Esempio n. 1
0
        private void FindBadCatchBlock(string program, int findCount, string msg)
        {
            using (TextReader text = new StringReader(program))
            {
                IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, text);
                parser.Parse();

                Assert.AreEqual(0, parser.Errors.Count, "expected no errors in the input code");

                CompilationUnit     cu      = parser.CompilationUnit;
                BadCatchBlockFinder visitor = new BadCatchBlockFinder();
                cu.AcceptVisitor(visitor, null);

                Assert.AreEqual(findCount, visitor.Found, msg);
            }
        }
        private void FindBadCatchBlock(string program, int findCount, string msg)
        {
            using (TextReader text = new StringReader(program))
            {
                IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, text);
                parser.Parse();

                Assert.AreEqual(0, parser.Errors.Count, "expected no errors in the input code");

                CompilationUnit cu = parser.CompilationUnit;
                BadCatchBlockFinder visitor = new BadCatchBlockFinder();
                cu.AcceptVisitor(visitor, null);

                Assert.AreEqual(findCount, visitor.Found, msg);
            }
        }