diff options
Diffstat (limited to 'specs/~lambdas.yml')
-rw-r--r-- | specs/~lambdas.yml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/specs/~lambdas.yml b/specs/~lambdas.yml index f3f3b0b..e4eea42 100644 --- a/specs/~lambdas.yml +++ b/specs/~lambdas.yml @@ -17,6 +17,7 @@ tests: data: lambda: !code ruby: 'proc { "world" }' + raku: 'sub { "world" }' perl: 'sub { "world" }' js: 'function() { return "world" }' php: 'return "world";' @@ -32,6 +33,7 @@ tests: planet: "world" lambda: !code ruby: 'proc { "{{planet}}" }' + raku: 'sub { q+{{planet}}+ }' perl: 'sub { "{{planet}}" }' js: 'function() { return "{{planet}}" }' php: 'return "{{planet}}";' @@ -47,6 +49,7 @@ tests: planet: "world" lambda: !code ruby: 'proc { "|planet| => {{planet}}" }' + raku: 'sub { q+|planet| => {{planet}}+ }' perl: 'sub { "|planet| => {{planet}}" }' js: 'function() { return "|planet| => {{planet}}" }' php: 'return "|planet| => {{planet}}";' @@ -61,6 +64,7 @@ tests: data: lambda: !code ruby: 'proc { $calls ||= 0; $calls += 1 }' + raku: 'sub { state $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;' @@ -75,6 +79,7 @@ tests: data: lambda: !code ruby: 'proc { ">" }' + raku: 'sub { ">" }' perl: 'sub { ">" }' js: 'function() { return ">" }' php: 'return ">";' @@ -90,6 +95,7 @@ tests: x: 'Error!' lambda: !code ruby: 'proc { |text| text == "{{x}}" ? "yes" : "no" }' + raku: 'sub { $^section eq q+{{x}}+ ?? "yes" !! "no" }' perl: 'sub { $_[0] eq "{{x}}" ? "yes" : "no" }' js: 'function(txt) { return (txt == "{{x}}" ? "yes" : "no") }' php: 'return ($text == "{{x}}") ? "yes" : "no";' @@ -105,6 +111,7 @@ tests: planet: "Earth" lambda: !code ruby: 'proc { |text| "#{text}{{planet}}#{text}" }' + raku: 'sub { $^section ~ q+{{planet}}+ ~ $^section }' perl: 'sub { $_[0] . "{{planet}}" . $_[0] }' js: 'function(txt) { return txt + "{{planet}}" + txt }' php: 'return $text . "{{planet}}" . $text;' @@ -120,6 +127,7 @@ tests: planet: "Earth" lambda: !code ruby: 'proc { |text| "#{text}{{planet}} => |planet|#{text}" }' + raku: 'sub { $^section ~ q+{{planet}} => |planet|+ ~ $^section }' perl: 'sub { $_[0] . "{{planet}} => |planet|" . $_[0] }' js: 'function(txt) { return txt + "{{planet}} => |planet|" + txt }' php: 'return $text . "{{planet}} => |planet|" . $text;' @@ -134,6 +142,7 @@ tests: data: lambda: !code ruby: 'proc { |text| "__#{text}__" }' + raku: 'sub { "__" ~ $^section ~ "__" }' perl: 'sub { "__" . $_[0] . "__" }' js: 'function(txt) { return "__" + txt + "__" }' php: 'return "__" . $text . "__";' @@ -149,6 +158,7 @@ tests: static: 'static' lambda: !code ruby: 'proc { |text| false }' + raku: 'sub { 0 }' perl: 'sub { 0 }' js: 'function(txt) { return false }' php: 'return false;' |