当前位置: 首页>>代码示例>>C#>>正文


C# ComparisonTest.RunJavascript方法代码示例

本文整理汇总了C#中JSIL.Tests.ComparisonTest.RunJavascript方法的典型用法代码示例。如果您正苦于以下问题:C# ComparisonTest.RunJavascript方法的具体用法?C# ComparisonTest.RunJavascript怎么用?C# ComparisonTest.RunJavascript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSIL.Tests.ComparisonTest的用法示例。


在下文中一共展示了ComparisonTest.RunJavascript方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenericIgnoreTest

        protected string GenericIgnoreTest(string fileName, string workingOutput, string jsErrorSubstring, string[] stubbedAssemblies = null)
        {
            long elapsed, temp;
            string generatedJs = null, jsOutput = null;

            using (var test = new ComparisonTest(EvaluatorPool, Portability.NormalizeDirectorySeparators(fileName), stubbedAssemblies)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);
                Assert.AreEqual(workingOutput, csOutput.Trim());

                try {
                    jsOutput = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed, MakeConfiguration);
                    Assert.Fail("Expected javascript to throw an exception containing the string \"" + jsErrorSubstring + "\".");
                } catch (JavaScriptEvaluatorException jse) {
                    bool foundMatch = false;

                    foreach (var exc in jse.Exceptions) {
                        if (exc.Message.Contains(jsErrorSubstring)) {
                            foundMatch = true;
                            break;
                        }
                    }

                    if (!foundMatch) {
                        Console.Error.WriteLine("// Was looking for a JS exception containing the string '{0}' but didn't find it.", jsErrorSubstring);
                        Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                        if (jsOutput != null)
                            Console.Error.WriteLine("// JS output: \r\n{0}", jsOutput);
                        throw;
                    }
                } catch {
                    Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                    if (jsOutput != null)
                        Console.Error.WriteLine("// JS output: \r\n{0}", jsOutput);
                    throw;
                }

            }

            return generatedJs;
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:40,代码来源:GenericTestFixture.cs

示例2: GenericTest

        protected string GenericTest(
            string fileName, string csharpOutput,
            string javascriptOutput, string[] stubbedAssemblies = null,
            TypeInfoProvider typeInfo = null
        )
        {
            long elapsed, temp;
            string generatedJs = null;

            using (var test = new ComparisonTest(EvaluatorPool, Portability.NormalizeDirectorySeparators(fileName), stubbedAssemblies, typeInfo)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);

                try {
                    var jsOutput = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed, MakeConfiguration);

                    Assert.AreEqual(Portability.NormalizeNewLines(csharpOutput), csOutput.Trim(), "Did not get expected output from C# test");
                    Assert.AreEqual(Portability.NormalizeNewLines(javascriptOutput), jsOutput.Trim(), "Did not get expected output from JavaScript test");
                } catch {
                    Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                    throw;
                }
            }

            return generatedJs;
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:25,代码来源:GenericTestFixture.cs

示例3: GenericTest

        protected string GenericTest(string fileName, string csharpOutput, string javascriptOutput, Regex[] stubbedAssemblies = null)
        {
            long elapsed, temp;
            string generatedJs;

            using (var test = new ComparisonTest(fileName, stubbedAssemblies)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);
                var jsOutput = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);

                Assert.AreEqual(csharpOutput, csOutput.Trim(), "Did not get expected output from C# test");
                Assert.AreEqual(javascriptOutput, jsOutput.Trim(), "Did not get expected output from JavaScript test");
            }

            return generatedJs;
        }
开发者ID:robashton,项目名称:JSIL,代码行数:15,代码来源:Util.cs

示例4: GetJavascript

        protected string GetJavascript(string fileName, string expectedText = null)
        {
            long elapsed, temp;
            string generatedJs;

            using (var test = new ComparisonTest(fileName)) {
                var output = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);

                if (expectedText != null)
                    Assert.AreEqual(expectedText, output.Trim());
            }

            return generatedJs;
        }
开发者ID:robashton,项目名称:JSIL,代码行数:14,代码来源:Util.cs

示例5: GenericIgnoreTest

        protected string GenericIgnoreTest(string fileName, string workingOutput, string jsErrorSubstring, Regex[] stubbedAssemblies = null)
        {
            long elapsed, temp;
            string generatedJs = null;

            using (var test = new ComparisonTest(fileName, stubbedAssemblies)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);
                Assert.AreEqual(workingOutput, csOutput.Trim());

                try {
                    test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);
                    Assert.Fail("Expected javascript to throw an exception containing the string \"" + jsErrorSubstring + "\".");
                } catch (JavaScriptException jse) {
                    if (!jse.ErrorText.Contains(jsErrorSubstring))
                        throw;
                }

            }

            return generatedJs;
        }
开发者ID:robashton,项目名称:JSIL,代码行数:21,代码来源:Util.cs

示例6: GetJavascript

        protected string GetJavascript(string fileName, string expectedText = null)
        {
            long elapsed, temp;
            string generatedJs = null, output;

            using (var test = new ComparisonTest(fileName)) {
                try {
                    output = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);
                } catch {
                    Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                    throw;
                }

                if (expectedText != null)
                    Assert.AreEqual(expectedText, output.Trim());
            }

            return generatedJs;
        }
开发者ID:Caspeco,项目名称:JSIL,代码行数:19,代码来源:Util.cs

示例7: GenericTest

        protected string GenericTest(string fileName, string csharpOutput, string javascriptOutput, string[] stubbedAssemblies = null)
        {
            long elapsed, temp;
            string generatedJs = null;

            using (var test = new ComparisonTest(fileName, stubbedAssemblies)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);

                try {
                    var jsOutput = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);

                    Assert.AreEqual(csharpOutput, csOutput.Trim(), "Did not get expected output from C# test");
                    Assert.AreEqual(javascriptOutput, jsOutput.Trim(), "Did not get expected output from JavaScript test");
                } catch {
                    Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                    throw;
                }
            }

            return generatedJs;
        }
开发者ID:Caspeco,项目名称:JSIL,代码行数:21,代码来源:Util.cs

示例8: GenericIgnoreTest

        protected string GenericIgnoreTest(string fileName, string workingOutput, string jsErrorSubstring, string[] stubbedAssemblies = null)
        {
            long elapsed, temp;
            string generatedJs = null, jsOutput = null;

            using (var test = new ComparisonTest(EvaluatorPool, fileName, stubbedAssemblies)) {
                var csOutput = test.RunCSharp(new string[0], out elapsed);
                Assert.AreEqual(workingOutput, csOutput.Trim());

                try {
                    jsOutput = test.RunJavascript(new string[0], out generatedJs, out temp, out elapsed);
                    Assert.Fail("Expected javascript to throw an exception containing the string \"" + jsErrorSubstring + "\".");
                } catch (JavaScriptException jse) {
                    if (!jse.ErrorText.Contains(jsErrorSubstring)) {
                        Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                        if (jsOutput != null)
                            Console.Error.WriteLine("// JS output: \r\n{0}", jsOutput);
                        throw;
                    }
                } catch {
                    Console.Error.WriteLine("// Generated JS: \r\n{0}", generatedJs);
                    if (jsOutput != null)
                        Console.Error.WriteLine("// JS output: \r\n{0}", jsOutput);
                    throw;
                }

            }

            return generatedJs;
        }
开发者ID:xen2,项目名称:JSIL,代码行数:30,代码来源:TestUtil.cs

示例9: PerformanceAnalysisData

        public PerformanceAnalysisData (ComparisonTest test, Func<Configuration> makeConfiguration = null) {
            string trailingOutput;
            string stderr;
            string tempS;
            long tempL;

            Output = test.RunJavascript(
                null, out tempS, out tempL, out tempL, out stderr, out trailingOutput,
                makeConfiguration: makeConfiguration
            );

            var singletonTypeIDs = new HashSet<UInt32>();
            TaggedObjectTypesByID = ParseTaggedObjectTypes(stderr, trailingOutput, singletonTypeIDs);
            TypeInformationByID = ParseTypeInformation(trailingOutput, TaggedObjectTypesByID, singletonTypeIDs);

            TaggedObjectTypeIDsByName = new Dictionary<string, uint>(TaggedObjectTypesByID.Count);
            foreach (var kvp in TaggedObjectTypesByID) {
                if (!TaggedObjectTypeIDsByName.ContainsKey(kvp.Value))
                    TaggedObjectTypeIDsByName.Add(kvp.Value, kvp.Key);
            }

            RawStdErr = stderr;
            RawTypeInformation = trailingOutput;
        }
开发者ID:Don191,项目名称:JSIL,代码行数:24,代码来源:PerformanceAnalysis.cs


注:本文中的JSIL.Tests.ComparisonTest.RunJavascript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。