Skip to content

Instantly share code, notes, and snippets.

@locks
Created April 15, 2014 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save locks/10729603 to your computer and use it in GitHub Desktop.
Save locks/10729603 to your computer and use it in GitHub Desktop.
➜ mustache git:(master) ✗ rake
Run options:
# Running tests:
[173/220] TestLambdas#test - Escaping = 0.00 s
1) Failure:
test - Escaping(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Lambda results should be appropriately escaped.
Data: {"lambda"=>{"ruby"=>"proc { \">\" }", "perl"=>"sub { \">\" }", "js"=>"function() { return \">\" }", "php"=>"return \">\";", "python"=>"lambda: \">\""}}
Template: "<{{lambda}}{{{lambda}}}"
Partials: {}
.
<"<&gt;>"> expected but was
<"<{&quot;ruby&quot;=&gt;&quot;proc { \\&quot;&gt;\\&quot; }&quot;, &quot;perl&quot;=&gt;&quot;sub { \\&quot;&gt;\\&quot; }&quot;, &quot;js&quot;=&gt;&quot;function() { return \\&quot;&gt;\\&quot; }&quot;, &quot;php&quot;=&gt;&quot;return \\&quot;&gt;\\&quot;;&quot;, &quot;python&quot;=&gt;&quot;lambda: \\&quot;&gt;\\&quot;&quot;}{\"ruby\"=>\"proc { \\\">\\\" }\", \"perl\"=>\"sub { \\\">\\\" }\", \"js\"=>\"function() { return \\\">\\\" }\", \"php\"=>\"return \\\">\\\";\", \"python\"=>\"lambda: \\\">\\\"\"}">.
[174/220] TestLambdas#test - Interpolation = 0.00 s
2) Failure:
test - Interpolation(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
A lambda's return value should be interpolated.
Data: {"lambda"=>{"ruby"=>"proc { \"world\" }", "perl"=>"sub { \"world\" }", "js"=>"function() { return \"world\" }", "php"=>"return \"world\";", "python"=>"lambda: \"world\""}}
Template: "Hello, {{lambda}}!"
Partials: {}
.
<"Hello, world!"> expected but was
<"Hello, {&quot;ruby&quot;=&gt;&quot;proc { \\&quot;world\\&quot; }&quot;, &quot;perl&quot;=&gt;&quot;sub { \\&quot;world\\&quot; }&quot;, &quot;js&quot;=&gt;&quot;function() { return \\&quot;world\\&quot; }&quot;, &quot;php&quot;=&gt;&quot;return \\&quot;world\\&quot;;&quot;, &quot;python&quot;=&gt;&quot;lambda: \\&quot;world\\&quot;&quot;}!">.
[175/220] TestLambdas#test - Interpolation - Alternate Delimiters = 0.00
3) Failure:
test - Interpolation - Alternate Delimiters(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
A lambda's return value should parse with the default delimiters.
Data: {"planet"=>"world", "lambda"=>{"ruby"=>"proc { \"|planet| => {{planet}}\" }", "perl"=>"sub { \"|planet| => {{planet}}\" }", "js"=>"function() { return \"|planet| => {{planet}}\" }", "php"=>"return \"|planet| => {{planet}}\";", "python"=>"lambda: \"|planet| => {{planet}}\""}}
Template: "{{= | | =}}\nHello, (|&lambda|)!"
Partials: {}
.
<"Hello, (|planet| => world)!"> expected but was
<"Hello, ({\"ruby\"=>\"proc { \\\"|planet| => {{planet}}\\\" }\", \"perl\"=>\"sub { \\\"|planet| => {{planet}}\\\" }\", \"js\"=>\"function() { return \\\"|planet| => {{planet}}\\\" }\", \"php\"=>\"return \\\"|planet| => {{planet}}\\\";\", \"python\"=>\"lambda: \\\"|planet| => {{planet}}\\\"\"})!">.
[176/220] TestLambdas#test - Interpolation - Expansion = 0.00 s
4) Failure:
test - Interpolation - Expansion(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
A lambda's return value should be parsed.
Data: {"planet"=>"world", "lambda"=>{"ruby"=>"proc { \"{{planet}}\" }", "perl"=>"sub { \"{{planet}}\" }", "js"=>"function() { return \"{{planet}}\" }", "php"=>"return \"{{planet}}\";", "python"=>"lambda: \"{{planet}}\""}}
Template: "Hello, {{lambda}}!"
Partials: {}
.
<"Hello, world!"> expected but was
<"Hello, {&quot;ruby&quot;=&gt;&quot;proc { \\&quot;{{planet}}\\&quot; }&quot;, &quot;perl&quot;=&gt;&quot;sub { \\&quot;{{planet}}\\&quot; }&quot;, &quot;js&quot;=&gt;&quot;function() { return \\&quot;{{planet}}\\&quot; }&quot;, &quot;php&quot;=&gt;&quot;return \\&quot;{{planet}}\\&quot;;&quot;, &quot;python&quot;=&gt;&quot;lambda: \\&quot;{{planet}}\\&quot;&quot;}!">.
[177/220] TestLambdas#test - Interpolation - Multiple Calls = 0.00 s
5) Failure:
test - Interpolation - Multiple Calls(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Interpolated lambdas should not be cached.
Data: {"lambda"=>{"ruby"=>"proc { $calls ||= 0; $calls += 1 }", "perl"=>"sub { no strict; $calls += 1 }", "js"=>"function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }", "php"=>"global $calls; return ++$calls;", "python"=>"lambda: globals().update(calls=globals().get(\"calls\",0)+1) or calls"}}
Template: "{{lambda}} == {{{lambda}}} == {{lambda}}"
Partials: {}
.
<"1 == 2 == 3"> expected but was
<"{&quot;ruby&quot;=&gt;&quot;proc { $calls ||= 0; $calls += 1 }&quot;, &quot;perl&quot;=&gt;&quot;sub { no strict; $calls += 1 }&quot;, &quot;js&quot;=&gt;&quot;function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }&quot;, &quot;php&quot;=&gt;&quot;global $calls; return ++$calls;&quot;, &quot;python&quot;=&gt;&quot;lambda: globals().update(calls=globals().get(\\&quot;calls\\&quot;,0)+1) or calls&quot;} == {\"ruby\"=>\"proc { $calls ||= 0; $calls += 1 }\", \"perl\"=>\"sub { no strict; $calls += 1 }\", \"js\"=>\"function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }\", \"php\"=>\"global $calls; return ++$calls;\", \"python\"=>\"lambda: globals().update(calls=globals().get(\\\"calls\\\",0)+1) or calls\"} == {&quot;ruby&quot;=&gt;&quot;proc { $calls ||= 0; $calls += 1 }&quot;, &quot;perl&quot;=&gt;&quot;sub { no strict; $calls += 1 }&quot;, &quot;js&quot;=&gt;&quot;function() { return (g=(function(){return this})()).calls=(g.calls||0)+1 }&quot;, &quot;php&quot;=&gt;&quot;global $calls; return ++$calls;&quot;, &quot;python&quot;=&gt;&quot;lambda: globals().update(calls=globals().get(\\&quot;calls\\&quot;,0)+1) or calls&quot;}">.
[179/220] TestLambdas#test - Section = 0.00 s
6) Failure:
test - Section(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Lambdas used for sections should receive the raw section string.
Data: {"x"=>"Error!", "lambda"=>{"ruby"=>"proc { |text| text == \"{{x}}\" ? \"yes\" : \"no\" }", "perl"=>"sub { $_[0] eq \"{{x}}\" ? \"yes\" : \"no\" }", "js"=>"function(txt) { return (txt == \"{{x}}\" ? \"yes\" : \"no\") }", "php"=>"return ($text == \"{{x}}\") ? \"yes\" : \"no\";", "python"=>"lambda text: text == \"{{x}}\" and \"yes\" or \"no\""}}
Template: "<{{#lambda}}{{x}}{{/lambda}}>"
Partials: {}
.
<"<yes>"> expected but was
<"<Error!>">.
[180/220] TestLambdas#test - Section - Alternate Delimiters = 0.00 s
7) Failure:
test - Section - Alternate Delimiters(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Lambdas used for sections should parse with the current delimiters.
Data: {"planet"=>"Earth", "lambda"=>{"ruby"=>"proc { |text| \"\#{text}{{planet}} => |planet|\#{text}\" }", "perl"=>"sub { $_[0] . \"{{planet}} => |planet|\" . $_[0] }", "js"=>"function(txt) { return txt + \"{{planet}} => |planet|\" + txt }", "php"=>"return $text . \"{{planet}} => |planet|\" . $text;", "python"=>"lambda text: \"%s{{planet}} => |planet|%s\" % (text, text)"}}
Template: "{{= | | =}}<|#lambda|-|/lambda|>"
Partials: {}
.
<"<-{{planet}} => Earth->"> expected but was
<"<->">.
[181/220] TestLambdas#test - Section - Expansion = 0.00 s
8) Failure:
test - Section - Expansion(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Lambdas used for sections should have their results parsed.
Data: {"planet"=>"Earth", "lambda"=>{"ruby"=>"proc { |text| \"\#{text}{{planet}}\#{text}\" }", "perl"=>"sub { $_[0] . \"{{planet}}\" . $_[0] }", "js"=>"function(txt) { return txt + \"{{planet}}\" + txt }", "php"=>"return $text . \"{{planet}}\" . $text;", "python"=>"lambda text: \"%s{{planet}}%s\" % (text, text)"}}
Template: "<{{#lambda}}-{{/lambda}}>"
Partials: {}
.
<"<-Earth->"> expected but was
<"<->">.
[182/220] TestLambdas#test - Section - Multiple Calls = 0.01 s
9) Failure:
test - Section - Multiple Calls(TestLambdas) [/Users/ricardomendes/src/mustache/test/spec_test.rb:67]:
Lambdas used for sections should not be cached.
Data: {"lambda"=>{"ruby"=>"proc { |text| \"__\#{text}__\" }", "perl"=>"sub { \"__\" . $_[0] . \"__\" }", "js"=>"function(txt) { return \"__\" + txt + \"__\" }", "php"=>"return \"__\" . $text . \"__\";", "python"=>"lambda text: \"__%s__\" % (text)"}}
Template: "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}"
Partials: {}
.
<"__FILE__ != __LINE__"> expected but was
<"FILE != LINE">.
Finished tests in 0.743403s, 295.9364 tests/s, 336.2914 assertions/s.
220 tests, 250 assertions, 9 failures, 0 errors, 0 skips
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
rake aborted!
Command failed with status (9): [ruby -I"lib:lib" -I"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0" "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rake/rake_test_loader.rb" "test/**/*_test.rb" ]
Tasks: TOP => default => test
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment