예제 #1
0
        public void FindReturnStatementsTest()
        {
            var methodBody = GenerateMethodBody(PythonCodeGenerator.GenerateDefaultReturnStatement());
            var finder     = BuildFinder(methodBody);

            var returnStatements = finder.FindReturnStatements();

            Assert.AreEqual(1, returnStatements.Count());
        }
예제 #2
0
        public void CountOfDirectStatementsInBodyTest()
        {
            var assignmentStatement = PythonCodeGenerator.GenerateDefaultAssignmentStatement();
            var embeddedStatement   = PythonCodeGenerator.GenerateDefaultCompoundStatement(2);
            var returnStatement     = PythonCodeGenerator.GenerateDefaultReturnStatement();

            string[] statements = { assignmentStatement, embeddedStatement, returnStatement };
            var      methodBody = GenerateMethodBody(statements);

            var finder = BuildFinder(methodBody);

            var statementsCount = finder.CountOfDirectStatementsInBody();

            Assert.AreEqual(3, statementsCount);
        }