コード例 #1
0
        private void WriteMethods(List <Call> calls, CoverageScope klass)
        {
            foreach (var child in klass.Children)
            {
                FunctionDefinition funcDef = child.Statement as FunctionDefinition;
                if (funcDef != null)
                {
                    List <Call> lines = new List <Call>();
                    lines.Add(WriteStats(child));
                    lines.AddRange(WriteLines(child.Lines));

                    calls.Add(
                        new Call(
                            string.Format(
                                "Function(\"{0}\",",
                                CoverageExporter.GetQualifiedFunctionName(child.Statement)
                                ),
                            lines.ToArray()
                            )
                        );

                    WriteMethods(calls, child);
                }
            }
        }
コード例 #2
0
            private bool FindFunction(CoverageMapper mapper, CoverageScope parentScope)
            {
                foreach (var scope in parentScope.Children)
                {
                    if (scope.Statement is FunctionDefinition)
                    {
                        if (CoverageExporter.GetQualifiedFunctionName(scope.Statement) == _name)
                        {
                            foreach (var expected in _expected)
                            {
                                expected.Validate(mapper, scope);
                            }
                            return(true);
                        }

                        if (FindFunction(mapper, scope))
                        {
                            // nested function...
                            return(true);
                        }
                    }
                }
                return(false);
            }