コード例 #1
0
 public void CompileFile_with_valid_CoffeeScript_returns_JavaScript()
 {
     var source = "x = 1";
     var compiler = new JurassicCoffeeScriptCompiler();
     var javaScript = compiler.Compile(source, new CompileContext());
     javaScript.Output.ShouldEqual("(function() {\n  var x;\n\n  x = 1;\n\n}).call(this);\n");
 }
コード例 #2
0
ファイル: ScriptPipeline.cs プロジェクト: prasanths/cassette
 public ScriptPipeline()
 {
     Minifier            = new MicrosoftJavaScriptMinifier();
     CompileCoffeeScript = true;
     // Default to the slower, but medium trust compatible, compiler.
     CoffeeScriptCompiler = new JurassicCoffeeScriptCompiler();
 }
コード例 #3
0
 public void CompileFile_with_invalid_CoffeeScript_throws_CompileException()
 {
     var source = "'unclosed string";
     var compiler = new JurassicCoffeeScriptCompiler();
     var exception = Assert.Throws<CoffeeScriptCompileException>(delegate
     {
         compiler.Compile(source, new CompileContext { SourceFilePath = "~/test.coffee" });
     });
     exception.Message.ShouldContain("Parse error on line 1: Unexpected ''' in ~/test.coffee");
     exception.SourcePath.ShouldEqual("~/test.coffee");
 }