示例#1
0
        protected IEnumerable <Metacomment> RunSingleComparisonTestCase(
            object[] parameters,
            Func <Configuration> makeConfiguration  = null,
            JSEvaluationConfig evaluationConfig     = null,
            Action <Exception> onTranslationFailure = null,
            string compilerOptions = "",
            Action <AssemblyTranslator> initializeTranslator = null,
            Func <string> getTestRunnerQueryString           = null,
            bool?scanForProxies           = null,
            string[] extraDependencies    = null,
            bool shouldRunJs              = true,
            string testFolderNameOverride = null
            )
        {
            if (parameters.Length != 5)
            {
                throw new ArgumentException("Wrong number of test case data parameters.");
            }

            var provider = (TypeInfoProvider)parameters[1];
            var cache    = (AssemblyCache)parameters[2];

            try {
                return(RunComparisonTest(
                           (string)parameters[0], null, provider, null, null, (string)parameters[3], shouldRunJs, cache,
                           makeConfiguration: makeConfiguration,
                           evaluationConfig: evaluationConfig,
                           onTranslationFailure: onTranslationFailure,
                           compilerOptions: compilerOptions,
                           initializeTranslator: initializeTranslator,
                           getTestRunnerQueryString: getTestRunnerQueryString,
                           scanForProxies: scanForProxies,
                           extraDependencies: extraDependencies,
                           testFolderNameOverride: testFolderNameOverride
                           ));
            } finally {
                if ((bool)parameters[4])
                {
                    if (provider != null)
                    {
                        provider.Dispose();
                    }
                    if (cache != null)
                    {
                        cache.Dispose();
                    }
                }
            }
        }
示例#2
0
        public string RunJavascript(
            string[] args, out string generatedJavascript, out long elapsedTranslation, out long elapsedJs,
            Func <Configuration> makeConfiguration           = null,
            JSEvaluationConfig evaluationConfig              = null,
            Action <Exception> onTranslationFailure          = null,
            Action <AssemblyTranslator> initializeTranslator = null
            )
        {
            string temp1, temp2;

            return(RunJavascript(
                       args, out generatedJavascript, out elapsedTranslation, out elapsedJs,
                       out temp1, out temp2,
                       makeConfiguration, evaluationConfig, onTranslationFailure, initializeTranslator
                       ));
        }
示例#3
0
        protected CompileResult RunSingleComparisonTestCase(
            object[] parameters,
            Func <Configuration> makeConfiguration  = null,
            JSEvaluationConfig evaluationConfig     = null,
            Action <Exception> onTranslationFailure = null,
            string compilerOptions = "",
            Action <AssemblyTranslator> initializeTranslator = null,
            Func <string> getTestRunnerQueryString           = null,
            bool?scanForProxies = null
            )
        {
            if (parameters.Length != 5)
            {
                throw new ArgumentException("Wrong number of test case data parameters.");
            }

            var provider = (TypeInfoProvider)parameters[1];
            var cache    = (AssemblyCache)parameters[2];

            try {
                return(RunComparisonTest(
                           (string)parameters[0], null, provider, null, null, (string)parameters[3], true, cache,
                           makeConfiguration: makeConfiguration,
                           evaluationConfig: evaluationConfig,
                           onTranslationFailure: onTranslationFailure,
                           compilerOptions: compilerOptions,
                           initializeTranslator: initializeTranslator,
                           getTestRunnerQueryString: getTestRunnerQueryString,
                           scanForProxies: scanForProxies
                           ));
            } finally {
                if ((bool)parameters[4])
                {
                    Console.WriteLine("Disposing cache and provider.");
                    if (provider != null)
                    {
                        provider.Dispose();
                    }
                    if (cache != null)
                    {
                        cache.Dispose();
                    }
                }
            }
        }
示例#4
0
        public string RunJavascript(
            string[] args, out Func <string> generateJavascript, out long elapsedTranslation, out long elapsedJs,
            Func <Configuration> makeConfiguration           = null,
            JSEvaluationConfig evaluationConfig              = null,
            Action <Exception> onTranslationFailure          = null,
            Action <AssemblyTranslator> initializeTranslator = null,
            bool?scanForProxies = null,
            IEnumerable <IAnalyzer> analyzers = null
            )
        {
            string temp1, temp2;

            return(RunJavascript(
                       args, out generateJavascript, out elapsedTranslation, out elapsedJs,
                       out temp1, out temp2,
                       makeConfiguration: makeConfiguration,
                       evaluationConfig: evaluationConfig,
                       onTranslationFailure: onTranslationFailure,
                       initializeTranslator: initializeTranslator,
                       scanForProxies: scanForProxies,
                       analyzers: analyzers
                       ));
        }
示例#5
0
        private CompileResult RunComparisonTest(
            string filename, string[] stubbedAssemblies = null,
            TypeInfoProvider typeInfo = null, Action <string, string> errorCheckPredicate = null,
            List <string> failureList = null, string commonFile      = null,
            bool shouldRunJs          = true, AssemblyCache asmCache = null,
            Func <Configuration> makeConfiguration  = null,
            Action <Exception> onTranslationFailure = null,
            JSEvaluationConfig evaluationConfig     = null,
            string compilerOptions = "",
            Action <AssemblyTranslator> initializeTranslator = null,
            Func <string> getTestRunnerQueryString           = null,
            bool?scanForProxies = null
            )
        {
            CompileResult result = null;

            Console.WriteLine("// {0} ... ", Path.GetFileName(filename));
            filename = Portability.NormalizeDirectorySeparators(filename);

            try {
                var testFilenames = new List <string>()
                {
                    filename
                };
                if (commonFile != null)
                {
                    testFilenames.Add(commonFile);
                }

                using (var test = new ComparisonTest(
                           EvaluatorPool,
                           testFilenames,
                           Path.Combine(
                               ComparisonTest.TestSourceFolder,
                               ComparisonTest.MapSourceFileToTestFile(filename)
                               ),
                           stubbedAssemblies, typeInfo, asmCache,
                           compilerOptions: compilerOptions
                           )) {
                    test.GetTestRunnerQueryString = getTestRunnerQueryString ?? test.GetTestRunnerQueryString;
                    result = test.CompileResult;

                    if (shouldRunJs)
                    {
                        test.Run(
                            makeConfiguration: makeConfiguration,
                            evaluationConfig: evaluationConfig,
                            onTranslationFailure: onTranslationFailure,
                            initializeTranslator: initializeTranslator,
                            scanForProxies: scanForProxies
                            );
                    }
                    else
                    {
                        string js;
                        long   elapsed;
                        try {
                            var csOutput = test.RunCSharp(new string[0], out elapsed);
                            test.GenerateJavascript(
                                new string[0], out js, out elapsed,
                                makeConfiguration,
                                evaluationConfig == null || evaluationConfig.ThrowOnUnimplementedExternals,
                                onTranslationFailure,
                                initializeTranslator
                                );

                            Console.WriteLine("generated");

                            if (errorCheckPredicate != null)
                            {
                                errorCheckPredicate(csOutput, js);
                            }
                        } catch (Exception) {
                            Console.WriteLine("error");
                            throw;
                        }
                    }
                }
            } catch (Exception ex) {
                if (ex.Message == "JS test failed")
                {
                    Debug.WriteLine(ex.InnerException);
                }
                else
                {
                    Debug.WriteLine(ex);
                }

                if (failureList != null)
                {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                }
                else
                {
                    throw;
                }
            }

            return(result);
        }
示例#6
0
        public void Run(
            string[] args = null,
            Func <Configuration> makeConfiguration = null,
            JSEvaluationConfig evaluationConfig    = null,
            bool dumpJsOnFailure = true,
            Action <Exception> onTranslationFailure          = null,
            Action <AssemblyTranslator> initializeTranslator = null,
            bool?scanForProxies = null
            )
        {
            var signals = new[] {
                new ManualResetEventSlim(false), new ManualResetEventSlim(false)
            };
            Func <string> generateJs = null;
            var           errors     = new Exception[2];
            var           outputs    = new string[2];
            var           elapsed    = new long[3];

            args = args ?? new string[0];

            if (AssemblyUtility != null)
            {
                ThreadPool.QueueUserWorkItem((_) => {
                    var oldCulture = Thread.CurrentThread.CurrentCulture;
                    try {
                        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                        outputs[0] = RunCSharp(args, out elapsed[0]).Replace("\r", "").Trim();
                    } catch (Exception ex) {
                        errors[0] = ex;
                    } finally {
                        Thread.CurrentThread.CurrentCulture = oldCulture;
                    }
                    signals[0].Set();
                });
            }
            else
            {
                outputs[0] = "";
                signals[0].Set();
            }

            ThreadPool.QueueUserWorkItem((_) => {
                try {
                    outputs[1] = RunJavascript(
                        args, out generateJs, out elapsed[1], out elapsed[2],
                        makeConfiguration: makeConfiguration,
                        evaluationConfig: evaluationConfig,
                        onTranslationFailure: onTranslationFailure,
                        initializeTranslator: initializeTranslator,
                        scanForProxies: scanForProxies
                        ).Replace("\r", "").Trim();
                } catch (Exception ex) {
                    errors[1] = ex;
                }
                signals[1].Set();
            });

            signals[0].Wait();
            signals[1].Wait();

            const int truncateThreshold = 4096;

            Action writeJSOutput = () => {
                Console.WriteLine("// JavaScript output begins //");
                if (outputs[1].Length > truncateThreshold)
                {
                    Console.WriteLine(outputs[1].Substring(0, truncateThreshold));
                    Console.WriteLine("(truncated)");
                }
                else
                {
                    Console.WriteLine(outputs[1]);
                }
            };

            try {
                if (errors[0] != null)
                {
                    throw new Exception("C# test failed", errors[0]);
                }
                else if (errors[1] != null)
                {
                    throw errors[1];
                }
                else if (AssemblyUtility != null)
                {
                    Assert.AreEqual(outputs[0], outputs[1]);
                }
                else
                {
                    Console.WriteLine("// Output validation suppressed (raw JS)");
                }

                if (AssemblyUtility == null)
                {
                    writeJSOutput();
                }

                string compileTime;
                if (CompilationCacheHit)
                {
                    compileTime = "cached";
                }
                else
                {
                    compileTime = string.Format("{0:0000}ms", CompilationElapsed.TotalMilliseconds);
                }

                Console.WriteLine(
                    "passed: CL:{0} TR:{2:0000}ms C#:{1:0000}ms JS:{3:0000}ms",
                    compileTime,
                    TimeSpan.FromTicks(elapsed[0]).TotalMilliseconds,
                    TimeSpan.FromTicks(elapsed[1]).TotalMilliseconds,
                    TimeSpan.FromTicks(elapsed[2]).TotalMilliseconds
                    );
            } catch (Exception ex) {
                var jsex = ex as JavaScriptEvaluatorException;
                Console.WriteLine("failed: " + ex.Message + " " + (ex.InnerException == null ? "" : ex.InnerException.Message));

                var queryString = string.Join(
                    "&",
                    (EvaluatorPool.EnvironmentVariables ?? new Dictionary <string, string>())
                    .Select(item => string.Format("{0}={1}", item.Key, item.Value))
                    .Concat(Enumerable.Repeat(GetTestRunnerQueryString(), 1))
                    .Where(str => !string.IsNullOrEmpty(str))
                    .ToArray());

                var files = new List <string> {
                    OutputPath
                };

                if (evaluationConfig != null)
                {
                    if (evaluationConfig.AdditionalFilesToLoad != null)
                    {
                        files.AddRange(evaluationConfig.AdditionalFilesToLoad);
                    }
                }

                Console.WriteLine("// {0}", GetTestRunnerLink(files, queryString));

                if ((outputs[1] == null) && (jsex != null))
                {
                    outputs[1] = jsex.Output;
                }

                if ((jsex != null) && (jsex.Exceptions.Length > 0))
                {
                    Console.WriteLine("// JS exceptions begin //");
                    foreach (var exc in jsex.Exceptions)
                    {
                        Console.WriteLine(exc);
                    }
                }

                if (outputs[0] != null)
                {
                    Console.WriteLine("// C# output begins //");
                    if (outputs[0].Length > truncateThreshold)
                    {
                        Console.WriteLine(outputs[0].Substring(0, truncateThreshold));
                        Console.WriteLine("(truncated)");
                    }
                    else
                    {
                        Console.WriteLine(outputs[0]);
                    }
                }
                if (outputs[1] != null)
                {
                    writeJSOutput();
                }

                if (dumpJsOnFailure && (generateJs != null))
                {
                    Console.WriteLine("// Generated javascript begins here //");
                    Console.WriteLine(generateJs());
                    Console.WriteLine("// Generated javascript ends here //");
                }

                throw;
            }
        }
示例#7
0
        public string RunJavascript(
            string[] args, out Func <string> generateJavascript, out long elapsedTranslation, out long elapsedJs, out string stderr, out string trailingOutput,
            Func <Configuration> makeConfiguration           = null,
            JSEvaluationConfig evaluationConfig              = null,
            Action <Exception> onTranslationFailure          = null,
            Action <AssemblyTranslator> initializeTranslator = null,
            bool?scanForProxies = null,
            IEnumerable <IAnalyzer> analyzers = null
            )
        {
            var tempFilename = GenerateJavascript(
                args, out generateJavascript, out elapsedTranslation,
                makeConfiguration,
                throwOnUnimplementedExternals:
                evaluationConfig == null || evaluationConfig.ThrowOnUnimplementedExternals,
                onTranslationFailure: onTranslationFailure,
                initializeTranslator: initializeTranslator,
                scanForProxies: scanForProxies,
                analyzers: analyzers
                );

            using (Evaluator = EvaluatorPool.Get()) {
                var startedJs     = DateTime.UtcNow.Ticks;
                var sentinelStart = "// Test output begins here //";
                var sentinelEnd   = "// Test output ends here //";
                var elapsedPrefix = "// elapsed: ";

                var manifest = String.Format(
                    "['Script', {0}]", Util.EscapeString(tempFilename)
                    );

                if (evaluationConfig != null && evaluationConfig.AdditionalFilesToLoad != null)
                {
                    foreach (var file in evaluationConfig.AdditionalFilesToLoad)
                    {
                        manifest += "," + Environment.NewLine + String.Format("['Script', {0}]", Util.EscapeString(file));
                    }
                }

                var dlls = Directory.GetFiles(SourceDirectory, "*.emjs");
                foreach (var dll in dlls)
                {
                    manifest += "," + Environment.NewLine +
                                String.Format("['NativeLibrary', {0}]", Util.EscapeString(Path.GetFullPath(dll)));
                }

                StartupPrologue =
                    String.Format("contentManifest['Test'] = [{0}]; ", manifest);

                StartupPrologue += String.Format("function runMain () {{ " +
                                                 "print({0}); try {{ var elapsedTime = runTestCase(Date.now); }} catch (exc) {{ reportException(exc); }} print({1}); print({2} + elapsedTime);" +
                                                 "}}; shellStartup();",
                                                 Util.EscapeString(sentinelStart),
                                                 Util.EscapeString(sentinelEnd),
                                                 Util.EscapeString(elapsedPrefix)
                                                 );

                Evaluator.WriteInput(StartupPrologue);

                Evaluator.Join();

                long endedJs = DateTime.UtcNow.Ticks;
                elapsedJs = endedJs - startedJs;

                if (Evaluator.ExitCode != 0)
                {
                    var _stdout = (Evaluator.StandardOutput ?? "").Trim();
                    var _stderr = (Evaluator.StandardError ?? "").Trim();

                    var exceptions = new List <JavaScriptException>();

                    var exceptionMatches = ExceptionRegex.Matches(_stdout);
                    foreach (Match match in exceptionMatches)
                    {
                        var    errorText = match.Groups["errorText"].Value;
                        string stackText = null;

                        if (match.Groups["stack"].Success)
                        {
                            stackText = match.Groups["stack"].Value;
                        }

                        var exception = new JavaScriptException(errorText, stackText);
                        exceptions.Add(exception);
                    }

                    throw new JavaScriptEvaluatorException(
                              Evaluator.ExitCode, _stdout, _stderr, exceptions.ToArray()
                              );
                }

                var stdout = Evaluator.StandardOutput;

                if (stdout != null)
                {
                    var m = ElapsedRegex.Match(stdout);
                    if (m.Success)
                    {
                        elapsedJs = TimeSpan.FromMilliseconds(
                            double.Parse(m.Groups["elapsed"].Value, CultureInfo.InvariantCulture)
                            ).Ticks;
                        stdout = stdout.Replace(m.Value, "");
                    }
                }

                // Strip spurious output from the JS.exe REPL and from the standard libraries
                trailingOutput = null;
                if (stdout != null)
                {
                    var startOffset = stdout.LastIndexOf(sentinelStart);

                    if (startOffset >= 0)
                    {
                        startOffset += sentinelStart.Length;

                        // End sentinel might not be there if the test case calls quit().
                        var endOffset = stdout.IndexOf(sentinelEnd, startOffset);
                        if (endOffset >= 0)
                        {
                            trailingOutput = stdout.Substring(endOffset + sentinelEnd.Length);
                            stdout         = stdout.Substring(startOffset, endOffset - startOffset);
                        }
                        else
                        {
                            stdout = stdout.Substring(startOffset);
                        }
                    }
                }

                stderr = Evaluator.StandardError;

                return(stdout ?? "");
            }
        }
示例#8
0
        public void Run(
            string[] args = null,
            Func <Configuration> makeConfiguration = null,
            JSEvaluationConfig evaluationConfig    = null,
            bool dumpJsOnFailure = true,
            Action <Exception> onTranslationFailure          = null,
            Action <AssemblyTranslator> initializeTranslator = null
            )
        {
            var signals = new[] {
                new ManualResetEventSlim(false), new ManualResetEventSlim(false)
            };
            var generatedJs = new string[1];
            var errors      = new Exception[2];
            var outputs     = new string[2];
            var elapsed     = new long[3];

            args = args ?? new string[0];

            if (Assembly != null)
            {
                ThreadPool.QueueUserWorkItem((_) => {
                    var oldCulture = Thread.CurrentThread.CurrentCulture;
                    try {
                        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                        outputs[0] = RunCSharp(args, out elapsed[0]).Replace("\r", "").Trim();
                    } catch (Exception ex) {
                        errors[0] = ex;
                    } finally {
                        Thread.CurrentThread.CurrentCulture = oldCulture;
                    }
                    signals[0].Set();
                });
            }
            else
            {
                outputs[0] = "";
                signals[0].Set();
            }

            ThreadPool.QueueUserWorkItem((_) => {
                try {
                    outputs[1] = RunJavascript(
                        args, out generatedJs[0], out elapsed[1], out elapsed[2],
                        makeConfiguration: makeConfiguration,
                        evaluationConfig: evaluationConfig,
                        onTranslationFailure: onTranslationFailure,
                        initializeTranslator: initializeTranslator
                        ).Replace("\r", "").Trim();
                } catch (Exception ex) {
                    errors[1] = ex;
                }
                signals[1].Set();
            });

            signals[0].Wait();
            signals[1].Wait();

            const int truncateThreshold = 4096;

            Action writeJSOutput = () => {
                Console.WriteLine("// JavaScript output begins //");
                if (outputs[1].Length > truncateThreshold)
                {
                    Console.WriteLine(outputs[1].Substring(0, truncateThreshold));
                    Console.WriteLine("(truncated)");
                }
                else
                {
                    Console.WriteLine(outputs[1]);
                }
            };

            try {
                if (errors[0] != null)
                {
                    throw new Exception("C# test failed", errors[0]);
                }
                else if (errors[1] != null)
                {
                    throw errors[1];
                }
                else if (Assembly != null)
                {
                    Assert.AreEqual(outputs[0], outputs[1]);
                }
                else
                {
                    Console.WriteLine("// Output validation suppressed (raw JS)");
                }

                if (Assembly == null)
                {
                    writeJSOutput();
                }

                Console.WriteLine(
                    "passed: CL:{0:0000}ms TR:{2:0000}ms C#:{1:0000}ms JS:{3:0000}ms",
                    CompilationElapsed.TotalMilliseconds,
                    TimeSpan.FromTicks(elapsed[0]).TotalMilliseconds,
                    TimeSpan.FromTicks(elapsed[1]).TotalMilliseconds,
                    TimeSpan.FromTicks(elapsed[2]).TotalMilliseconds
                    );
            } catch (Exception ex) {
                var jsex = ex as JavaScriptEvaluatorException;
                Console.WriteLine("failed: " + ex.Message + " " + (ex.InnerException == null ? "" : ex.InnerException.Message));

                Console.WriteLine("// {0}", GetTestRunnerLink(OutputPath));

                if ((outputs[1] == null) && (jsex != null))
                {
                    outputs[1] = jsex.Output;
                }

                if ((jsex != null) && (jsex.Exceptions.Length > 0))
                {
                    Console.WriteLine("// JS exceptions begin //");
                    foreach (var exc in jsex.Exceptions)
                    {
                        Console.WriteLine(exc);
                    }
                }

                if (outputs[0] != null)
                {
                    Console.WriteLine("// C# output begins //");
                    if (outputs[0].Length > truncateThreshold)
                    {
                        Console.WriteLine(outputs[0].Substring(0, truncateThreshold));
                        Console.WriteLine("(truncated)");
                    }
                    else
                    {
                        Console.WriteLine(outputs[0]);
                    }
                }
                if (outputs[1] != null)
                {
                    writeJSOutput();
                }

                if (dumpJsOnFailure && (generatedJs[0] != null))
                {
                    Console.WriteLine("// Generated javascript begins here //");
                    Console.WriteLine(generatedJs[0]);
                    Console.WriteLine("// Generated javascript ends here //");
                }

                throw;
            }
        }
示例#9
0
        private IEnumerable <Metacomment> RunComparisonTest(
            string filename, string[] stubbedAssemblies = null,
            TypeInfoProvider typeInfo = null, Action <string, Func <string> > errorCheckPredicate = null,
            List <string> failureList = null, string commonFile      = null,
            bool shouldRunJs          = true, AssemblyCache asmCache = null,
            Func <Configuration> makeConfiguration  = null,
            Action <Exception> onTranslationFailure = null,
            JSEvaluationConfig evaluationConfig     = null,
            string compilerOptions = "",
            Action <AssemblyTranslator> initializeTranslator = null,
            Func <string> getTestRunnerQueryString           = null,
            bool?scanForProxies           = null,
            string[] extraDependencies    = null,
            string testFolderNameOverride = null
            )
        {
            IEnumerable <Metacomment> result = null;

            Console.WriteLine("// {0} ... ", Path.GetFileName(filename));
            filename = Portability.NormalizeDirectorySeparators(filename);

            try {
                var testFilenames = new List <string>()
                {
                    filename
                };
                if (commonFile != null)
                {
                    testFilenames.Add(commonFile);
                }

                var testDirectoryName = testFolderNameOverride ??
                                        TestContext.CurrentContext.Test.FullName.Replace(
                    "." + TestContext.CurrentContext.Test.Name, String.Empty);
                var testFileDirectory = Path.Combine(
                    ComparisonTest.TestSourceFolder,
                    Path.GetDirectoryName(filename));
                var testDirectory = Path.Combine(testFileDirectory, testDirectoryName);
                Directory.CreateDirectory(testDirectory);

                using (var test = new ComparisonTest(
                           EvaluatorPool,
                           testFilenames,
                           Path.Combine(
                               testDirectory,
                               ComparisonTest.MapSourceFileToTestFile(Path.GetFileName(filename))
                               ),
                           stubbedAssemblies, typeInfo, asmCache,
                           compilerOptions: compilerOptions
                           )) {
                    test.GetTestRunnerQueryString = getTestRunnerQueryString ?? test.GetTestRunnerQueryString;
                    result = test.Metacomments;

                    if (extraDependencies != null)
                    {
                        var destDir = Path.GetDirectoryName(test.AssemblyUtility.AssemblyLocation);

                        foreach (var dependency in extraDependencies)
                        {
                            File.Copy(dependency, Path.Combine(destDir, Path.GetFileName(dependency)), true);
                        }
                    }

                    if (shouldRunJs)
                    {
                        test.Run(
                            makeConfiguration: makeConfiguration,
                            evaluationConfig: evaluationConfig,
                            onTranslationFailure: onTranslationFailure,
                            initializeTranslator: initializeTranslator,
                            scanForProxies: scanForProxies
                            );
                    }
                    else
                    {
                        Func <string> getJs;
                        long          elapsed;
                        try {
                            var csOutput = test.RunCSharp(new string[0], out elapsed);
                            test.GenerateJavascript(
                                new string[0], out getJs, out elapsed,
                                makeConfiguration,
                                evaluationConfig == null || evaluationConfig.ThrowOnUnimplementedExternals,
                                onTranslationFailure,
                                initializeTranslator,
                                shouldWritePrologue: false
                                );

                            Console.WriteLine("generated");

                            if (errorCheckPredicate != null)
                            {
                                errorCheckPredicate(csOutput, getJs);
                            }
                        } catch (Exception) {
                            Console.WriteLine("error");
                            throw;
                        }
                    }
                }
            } catch (Exception ex) {
                if (ex.Message == "JS test failed")
                {
                    Debug.WriteLine(ex.InnerException);
                }
                else
                {
                    Debug.WriteLine(ex);
                }

                if (failureList != null)
                {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                }
                else
                {
                    throw;
                }
            }

            return(result);
        }