Permalink
Browse files

Added tests for macro inheritance

  • Loading branch information...
1 parent 2d9bfd7 commit 819e3ed72c201ddb867b528ab713bc82a4c4e5ff @chregu committed Feb 5, 2011
@@ -0,0 +1,19 @@
+--TEST--
+"macro" tag - inheritance
+--TEMPLATE--
+{% import 'forms.twig' as forms %}
+
+{{ forms.foo('foo') }}
+{{ forms.bar('foo') }}
+--TEMPLATE(forms.twig)--
+{% extends 'formsparent.twig' %}
+{% macro foo(name) %}foo{{ name }} (overwritten){% endmacro %}
+--TEMPLATE(formsparent.twig)--
+{% macro foo(name) %}foo{{ name }}{% endmacro %}
+{% macro bar(name) %}bar{{ name }}{% endmacro %}
+
+--DATA--
+return array()
+--EXPECT--
+foofoo (overwritten)
+barfoo
@@ -0,0 +1,19 @@
+--TEST--
+"macro" tag - inheritance
+--TEMPLATE--
+{% from 'forms.twig' import foo, bar as barfoo %}
+
+{{ foo('foo') }}
+{{ barfoo('foo') }}
+--TEMPLATE(forms.twig)--
+{% extends 'formsparent.twig' %}
+{% macro foo(name) %}foo{{ name }} (overwritten){% endmacro %}
+--TEMPLATE(formsparent.twig)--
+{% macro foo(name) %}foo{{ name }}{% endmacro %}
+{% macro bar(name) %}bar{{ name }}{% endmacro %}
+
+--DATA--
+return array()
+--EXPECT--
+foofoo (overwritten)
+barfoo
@@ -0,0 +1,19 @@
+--TEST--
+"macro" tag
+--TEMPLATE--
+{% extends "forms.twig" %}
+{% block content %}
+{{ _self.foo('foo') }}
+{{ _self.bar('foo') }}
+{% endblock %}
+
+{% macro foo(name) %}foo{{ name }} (overwritten){% endmacro %}
+--TEMPLATE(forms.twig)--
+{% block content %}{% endblock %}
+{% macro foo(name) %}foo{{ name }}{% endmacro %}
+{% macro bar(name) %}bar{{ name }}{% endmacro %}
+--DATA--
+return array()
+--EXPECT--
+foofoo (overwritten)
+barfoo

0 comments on commit 819e3ed

Please sign in to comment.