summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/template/templates
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/template/templates')
-rw-r--r--test/integration/targets/template/templates/6653-include.j21
-rw-r--r--test/integration/targets/template/templates/6653.j24
-rw-r--r--test/integration/targets/template/templates/72262-included.j21
-rw-r--r--test/integration/targets/template/templates/72262-vars.j21
-rw-r--r--test/integration/targets/template/templates/72262.j23
-rw-r--r--test/integration/targets/template/templates/72615-macro-nested.j24
-rw-r--r--test/integration/targets/template/templates/72615-macro.j28
-rw-r--r--test/integration/targets/template/templates/72615.j24
-rw-r--r--test/integration/targets/template/templates/bar1
-rw-r--r--test/integration/targets/template/templates/café.j21
-rw-r--r--test/integration/targets/template/templates/custom_comment_string.j23
-rw-r--r--test/integration/targets/template/templates/empty_template.j20
-rw-r--r--test/integration/targets/template/templates/encoding_1252.j21
-rw-r--r--test/integration/targets/template/templates/foo.j23
-rw-r--r--test/integration/targets/template/templates/foo2.j23
-rw-r--r--test/integration/targets/template/templates/foo3.j23
-rw-r--r--test/integration/targets/template/templates/for_loop.j24
-rw-r--r--test/integration/targets/template/templates/for_loop_include.j23
-rw-r--r--test/integration/targets/template/templates/for_loop_include_nested.j21
-rw-r--r--test/integration/targets/template/templates/import_as.j24
-rw-r--r--test/integration/targets/template/templates/import_as_with_context.j23
-rw-r--r--test/integration/targets/template/templates/import_with_context.j24
-rw-r--r--test/integration/targets/template/templates/indirect_dict.j21
-rw-r--r--test/integration/targets/template/templates/json_macro.j22
-rw-r--r--test/integration/targets/template/templates/lstrip_blocks.j28
-rw-r--r--test/integration/targets/template/templates/macro_using_globals.j23
-rw-r--r--test/integration/targets/template/templates/override_colon_value.j24
-rw-r--r--test/integration/targets/template/templates/override_separator.j21
-rw-r--r--test/integration/targets/template/templates/parent.j23
-rw-r--r--test/integration/targets/template/templates/qux1
-rw-r--r--test/integration/targets/template/templates/short.j21
-rw-r--r--test/integration/targets/template/templates/subtemplate.j22
-rw-r--r--test/integration/targets/template/templates/template_destpath_test.j21
-rw-r--r--test/integration/targets/template/templates/template_import_macro_globals.j22
-rw-r--r--test/integration/targets/template/templates/trim_blocks.j24
-rw-r--r--test/integration/targets/template/templates/unused_vars_include.j21
-rw-r--r--test/integration/targets/template/templates/unused_vars_template.j22
37 files changed, 96 insertions, 0 deletions
diff --git a/test/integration/targets/template/templates/6653-include.j2 b/test/integration/targets/template/templates/6653-include.j2
new file mode 100644
index 0000000..26443b1
--- /dev/null
+++ b/test/integration/targets/template/templates/6653-include.j2
@@ -0,0 +1 @@
+{{ x }}
diff --git a/test/integration/targets/template/templates/6653.j2 b/test/integration/targets/template/templates/6653.j2
new file mode 100644
index 0000000..8026a79
--- /dev/null
+++ b/test/integration/targets/template/templates/6653.j2
@@ -0,0 +1,4 @@
+{% for x in mylist %}
+{{ x }}
+{% include '6653-include.j2' with context %}
+{% endfor %}
diff --git a/test/integration/targets/template/templates/72262-included.j2 b/test/integration/targets/template/templates/72262-included.j2
new file mode 100644
index 0000000..35700cb
--- /dev/null
+++ b/test/integration/targets/template/templates/72262-included.j2
@@ -0,0 +1 @@
+{{ vars.test }}
diff --git a/test/integration/targets/template/templates/72262-vars.j2 b/test/integration/targets/template/templates/72262-vars.j2
new file mode 100644
index 0000000..6ef9220
--- /dev/null
+++ b/test/integration/targets/template/templates/72262-vars.j2
@@ -0,0 +1 @@
+{% set test = "I'm test variable" %}
diff --git a/test/integration/targets/template/templates/72262.j2 b/test/integration/targets/template/templates/72262.j2
new file mode 100644
index 0000000..b72be0d
--- /dev/null
+++ b/test/integration/targets/template/templates/72262.j2
@@ -0,0 +1,3 @@
+{% import '72262-vars.j2' as vars with context %}
+{% macro included() %}{% include '72262-included.j2' %}{% endmacro %}
+{{ included()|indent }}
diff --git a/test/integration/targets/template/templates/72615-macro-nested.j2 b/test/integration/targets/template/templates/72615-macro-nested.j2
new file mode 100644
index 0000000..c47a499
--- /dev/null
+++ b/test/integration/targets/template/templates/72615-macro-nested.j2
@@ -0,0 +1,4 @@
+{% macro print_context_vars_nested(value) %}
+foo: {{ foo }}
+bar: {{ value }}
+{% endmacro %}
diff --git a/test/integration/targets/template/templates/72615-macro.j2 b/test/integration/targets/template/templates/72615-macro.j2
new file mode 100644
index 0000000..328c271
--- /dev/null
+++ b/test/integration/targets/template/templates/72615-macro.j2
@@ -0,0 +1,8 @@
+{% macro print_context_vars(value) %}
+{{ foo }}
+{{ value }}
+{% set foo = "template-nested-level-foo" %}
+{% set bar = "template-nested-level-bar" %}
+{% from '72615-macro-nested.j2' import print_context_vars_nested with context %}
+{{ print_context_vars_nested(bar) }}
+{% endmacro %}
diff --git a/test/integration/targets/template/templates/72615.j2 b/test/integration/targets/template/templates/72615.j2
new file mode 100644
index 0000000..b79f88e
--- /dev/null
+++ b/test/integration/targets/template/templates/72615.j2
@@ -0,0 +1,4 @@
+{% set foo = "template-level-foo" %}
+{% set bar = "template-level-bar" %}
+{% from '72615-macro.j2' import print_context_vars with context %}
+{{ print_context_vars(bar) }}
diff --git a/test/integration/targets/template/templates/bar b/test/integration/targets/template/templates/bar
new file mode 100644
index 0000000..2b60207
--- /dev/null
+++ b/test/integration/targets/template/templates/bar
@@ -0,0 +1 @@
+Goodbye
diff --git a/test/integration/targets/template/templates/café.j2 b/test/integration/targets/template/templates/café.j2
new file mode 100644
index 0000000..ef7e08e
--- /dev/null
+++ b/test/integration/targets/template/templates/café.j2
@@ -0,0 +1 @@
+{{ ansible_managed }}
diff --git a/test/integration/targets/template/templates/custom_comment_string.j2 b/test/integration/targets/template/templates/custom_comment_string.j2
new file mode 100644
index 0000000..db0af48
--- /dev/null
+++ b/test/integration/targets/template/templates/custom_comment_string.j2
@@ -0,0 +1,3 @@
+Before
+[# Test comment_start_string #]
+After
diff --git a/test/integration/targets/template/templates/empty_template.j2 b/test/integration/targets/template/templates/empty_template.j2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/integration/targets/template/templates/empty_template.j2
diff --git a/test/integration/targets/template/templates/encoding_1252.j2 b/test/integration/targets/template/templates/encoding_1252.j2
new file mode 100644
index 0000000..0d3cc35
--- /dev/null
+++ b/test/integration/targets/template/templates/encoding_1252.j2
@@ -0,0 +1 @@
+windows-1252 Special Characters: €‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
diff --git a/test/integration/targets/template/templates/foo.j2 b/test/integration/targets/template/templates/foo.j2
new file mode 100644
index 0000000..22187f9
--- /dev/null
+++ b/test/integration/targets/template/templates/foo.j2
@@ -0,0 +1,3 @@
+{{ templated_var }}
+
+{{ templated_dict | to_nice_json }}
diff --git a/test/integration/targets/template/templates/foo2.j2 b/test/integration/targets/template/templates/foo2.j2
new file mode 100644
index 0000000..e6e3485
--- /dev/null
+++ b/test/integration/targets/template/templates/foo2.j2
@@ -0,0 +1,3 @@
+BEGIN
+{{ templated_var }}
+END
diff --git a/test/integration/targets/template/templates/foo3.j2 b/test/integration/targets/template/templates/foo3.j2
new file mode 100644
index 0000000..710d55a
--- /dev/null
+++ b/test/integration/targets/template/templates/foo3.j2
@@ -0,0 +1,3 @@
+BEGIN
+[% templated_var %]
+END
diff --git a/test/integration/targets/template/templates/for_loop.j2 b/test/integration/targets/template/templates/for_loop.j2
new file mode 100644
index 0000000..49fa412
--- /dev/null
+++ b/test/integration/targets/template/templates/for_loop.j2
@@ -0,0 +1,4 @@
+{% for par_var in parent_vars %}
+{% include 'for_loop_include.j2' %}
+
+{% endfor %}
diff --git a/test/integration/targets/template/templates/for_loop_include.j2 b/test/integration/targets/template/templates/for_loop_include.j2
new file mode 100644
index 0000000..b1a0ad7
--- /dev/null
+++ b/test/integration/targets/template/templates/for_loop_include.j2
@@ -0,0 +1,3 @@
+{% if par_var is defined %}
+{% include 'for_loop_include_nested.j2' %}
+{% endif %}
diff --git a/test/integration/targets/template/templates/for_loop_include_nested.j2 b/test/integration/targets/template/templates/for_loop_include_nested.j2
new file mode 100644
index 0000000..368bce4
--- /dev/null
+++ b/test/integration/targets/template/templates/for_loop_include_nested.j2
@@ -0,0 +1 @@
+{{ par_var }}
diff --git a/test/integration/targets/template/templates/import_as.j2 b/test/integration/targets/template/templates/import_as.j2
new file mode 100644
index 0000000..b06f1be
--- /dev/null
+++ b/test/integration/targets/template/templates/import_as.j2
@@ -0,0 +1,4 @@
+{% import 'qux' as qux %}
+hello world import as
+{{ qux.wibble }}
+{% include 'bar' %}
diff --git a/test/integration/targets/template/templates/import_as_with_context.j2 b/test/integration/targets/template/templates/import_as_with_context.j2
new file mode 100644
index 0000000..3dd806a
--- /dev/null
+++ b/test/integration/targets/template/templates/import_as_with_context.j2
@@ -0,0 +1,3 @@
+{% import 'qux' as qux with context %}
+hello world as qux with context
+{{ qux.wibble }}
diff --git a/test/integration/targets/template/templates/import_with_context.j2 b/test/integration/targets/template/templates/import_with_context.j2
new file mode 100644
index 0000000..104e68b
--- /dev/null
+++ b/test/integration/targets/template/templates/import_with_context.j2
@@ -0,0 +1,4 @@
+{% import 'qux' as qux with context %}
+hello world with context
+{{ qux.wibble }}
+{% include 'bar' %}
diff --git a/test/integration/targets/template/templates/indirect_dict.j2 b/test/integration/targets/template/templates/indirect_dict.j2
new file mode 100644
index 0000000..3124371
--- /dev/null
+++ b/test/integration/targets/template/templates/indirect_dict.j2
@@ -0,0 +1 @@
+{{ v.foo }}
diff --git a/test/integration/targets/template/templates/json_macro.j2 b/test/integration/targets/template/templates/json_macro.j2
new file mode 100644
index 0000000..080f164
--- /dev/null
+++ b/test/integration/targets/template/templates/json_macro.j2
@@ -0,0 +1,2 @@
+{% macro m() %}{{ {"foo":"bar"} }}{% endmacro %}
+{{ m() }}
diff --git a/test/integration/targets/template/templates/lstrip_blocks.j2 b/test/integration/targets/template/templates/lstrip_blocks.j2
new file mode 100644
index 0000000..d572da6
--- /dev/null
+++ b/test/integration/targets/template/templates/lstrip_blocks.j2
@@ -0,0 +1,8 @@
+{% set hello_world="hello world" %}
+{% for i in [1, 2, 3] %}
+ {% if loop.first %}
+{{hello_world}}
+ {% else %}
+{{hello_world}}
+ {% endif %}
+{% endfor %}
diff --git a/test/integration/targets/template/templates/macro_using_globals.j2 b/test/integration/targets/template/templates/macro_using_globals.j2
new file mode 100644
index 0000000..d8d0626
--- /dev/null
+++ b/test/integration/targets/template/templates/macro_using_globals.j2
@@ -0,0 +1,3 @@
+{% macro foo(bar) -%}
+{{ bar }}={{ lookup('lines', 'echo lookedup_bar') }}
+{%- endmacro %}
diff --git a/test/integration/targets/template/templates/override_colon_value.j2 b/test/integration/targets/template/templates/override_colon_value.j2
new file mode 100644
index 0000000..2ca9bb8
--- /dev/null
+++ b/test/integration/targets/template/templates/override_colon_value.j2
@@ -0,0 +1,4 @@
+#jinja2: line_statement_prefix:":"
+: if true
+foo
+: endif
diff --git a/test/integration/targets/template/templates/override_separator.j2 b/test/integration/targets/template/templates/override_separator.j2
new file mode 100644
index 0000000..7589cc3
--- /dev/null
+++ b/test/integration/targets/template/templates/override_separator.j2
@@ -0,0 +1 @@
+#jinja2: lstrip_blocks=True
diff --git a/test/integration/targets/template/templates/parent.j2 b/test/integration/targets/template/templates/parent.j2
new file mode 100644
index 0000000..99a8e4c
--- /dev/null
+++ b/test/integration/targets/template/templates/parent.j2
@@ -0,0 +1,3 @@
+{% for parent_item in parent_vars %}
+{% include "subtemplate.j2" %}
+{% endfor %}
diff --git a/test/integration/targets/template/templates/qux b/test/integration/targets/template/templates/qux
new file mode 100644
index 0000000..d8cd22e
--- /dev/null
+++ b/test/integration/targets/template/templates/qux
@@ -0,0 +1 @@
+{% set wibble = "WIBBLE" %}
diff --git a/test/integration/targets/template/templates/short.j2 b/test/integration/targets/template/templates/short.j2
new file mode 100644
index 0000000..55aab8f
--- /dev/null
+++ b/test/integration/targets/template/templates/short.j2
@@ -0,0 +1 @@
+{{ templated_var }}
diff --git a/test/integration/targets/template/templates/subtemplate.j2 b/test/integration/targets/template/templates/subtemplate.j2
new file mode 100644
index 0000000..f359bf2
--- /dev/null
+++ b/test/integration/targets/template/templates/subtemplate.j2
@@ -0,0 +1,2 @@
+{{ parent_item }}
+
diff --git a/test/integration/targets/template/templates/template_destpath_test.j2 b/test/integration/targets/template/templates/template_destpath_test.j2
new file mode 100644
index 0000000..1d21d8c
--- /dev/null
+++ b/test/integration/targets/template/templates/template_destpath_test.j2
@@ -0,0 +1 @@
+{{ template_destpath }}
diff --git a/test/integration/targets/template/templates/template_import_macro_globals.j2 b/test/integration/targets/template/templates/template_import_macro_globals.j2
new file mode 100644
index 0000000..9b9a9c6
--- /dev/null
+++ b/test/integration/targets/template/templates/template_import_macro_globals.j2
@@ -0,0 +1,2 @@
+{% from 'macro_using_globals.j2' import foo %}
+{{ foo('bar') }}
diff --git a/test/integration/targets/template/templates/trim_blocks.j2 b/test/integration/targets/template/templates/trim_blocks.j2
new file mode 100644
index 0000000..824a0a0
--- /dev/null
+++ b/test/integration/targets/template/templates/trim_blocks.j2
@@ -0,0 +1,4 @@
+{% if True %}
+Hello world
+{% endif %}
+Goodbye
diff --git a/test/integration/targets/template/templates/unused_vars_include.j2 b/test/integration/targets/template/templates/unused_vars_include.j2
new file mode 100644
index 0000000..457cbbc
--- /dev/null
+++ b/test/integration/targets/template/templates/unused_vars_include.j2
@@ -0,0 +1 @@
+{{ var_set_in_template }}
diff --git a/test/integration/targets/template/templates/unused_vars_template.j2 b/test/integration/targets/template/templates/unused_vars_template.j2
new file mode 100644
index 0000000..28afc90
--- /dev/null
+++ b/test/integration/targets/template/templates/unused_vars_template.j2
@@ -0,0 +1,2 @@
+{% set var_set_in_template=test_var %}
+{% include "unused_vars_include.j2" %}