summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-05 18:30:32 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-05 18:30:32 -0500
commit6ff12b877afbda62ad2cb6d748487e7674e5c396 (patch)
tree74fa460cfbb35ff23603a8ee4e3a84c7d2dda52b /t
parentf805baad91b66f47885160afaed141a4e4c5fa67 (diff)
downloadtext-handlebars-6ff12b877afbda62ad2cb6d748487e7674e5c396.tar.gz
text-handlebars-6ff12b877afbda62ad2cb6d748487e7674e5c396.zip
change back to defining helpers and functions separately
helpers are different from functions because they implicitly receive the current context as the first argument, so they need to be declared differently. they work identically to functions in all other respects.
Diffstat (limited to 't')
-rw-r--r--t/block-helpers.t26
-rw-r--r--t/helpers-examples.t4
-rw-r--r--t/helpers.t6
3 files changed, 18 insertions, 18 deletions
diff --git a/t/block-helpers.t b/t/block-helpers.t
index 5ca009a..4b68d1e 100644
--- a/t/block-helpers.t
+++ b/t/block-helpers.t
@@ -7,7 +7,7 @@ use Test::Handlebars;
render_ok(
{
- function => {
+ helpers => {
noop => sub {
my ($context, $options) = @_;
return $options->{fn}->($context);
@@ -36,7 +36,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
with => sub {
my ($context, $new_context, $options) = @_;
return $options->{fn}->($new_context);
@@ -71,7 +71,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
with => sub {
my ($context, $new_context, $options) = @_;
return $options->{fn}->($new_context);
@@ -138,7 +138,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
my $out = "<ul>";
@@ -178,7 +178,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
if => sub {
my ($context, $conditional, $options) = @_;
if ($conditional) {
@@ -204,7 +204,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
if => sub {
my ($context, $conditional, $options) = @_;
if ($conditional) {
@@ -229,7 +229,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
if => sub {
my ($context, $conditional, $options) = @_;
if ($conditional) {
@@ -259,7 +259,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
if => sub {
my ($context, $conditional, $options) = @_;
if ($conditional) {
@@ -290,7 +290,7 @@ RENDERED
{ local $TODO = "unimplemented"; local $SIG{__WARN__} = sub { };
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
@@ -336,7 +336,7 @@ RENDERED
# more reasonable. feedback welcome!
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
@@ -380,7 +380,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
@@ -413,7 +413,7 @@ render_ok(
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
@@ -443,7 +443,7 @@ render_ok(
render_ok(
{
- function => {
+ helpers => {
list => sub {
my ($context, $items, $options) = @_;
diff --git a/t/helpers-examples.t b/t/helpers-examples.t
index 1df8e99..8f5a2fc 100644
--- a/t/helpers-examples.t
+++ b/t/helpers-examples.t
@@ -9,7 +9,7 @@ use Text::Xslate 'mark_raw';
render_ok(
{
- function => {
+ helpers => {
fullName => sub {
my ($context, $person) = @_;
return $person->{firstName} . ' ' . $person->{lastName};
@@ -55,7 +55,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
agree_button => sub {
my ($context) = @_;
return mark_raw(
diff --git a/t/helpers.t b/t/helpers.t
index 98a72ba..51ab9ac 100644
--- a/t/helpers.t
+++ b/t/helpers.t
@@ -9,7 +9,7 @@ use Text::Xslate 'mark_raw';
render_ok(
{
- function => {
+ helpers => {
link => sub {
my ($context, $object) = @_;
return mark_raw(
@@ -37,7 +37,7 @@ RENDERED
render_ok(
{
- function => {
+ helpers => {
link => sub {
my ($context, $text, $url) = @_;
return mark_raw(
@@ -63,7 +63,7 @@ RENDERED
{ local $TODO = "unimplemented";
render_ok(
{
- function => {
+ helpers => {
link => sub {
my ($context, $text, $options) = @_;