summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/jinja2_native_types/test_concatentation.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/jinja2_native_types/test_concatentation.yml')
-rw-r--r--test/integration/targets/jinja2_native_types/test_concatentation.yml88
1 files changed, 88 insertions, 0 deletions
diff --git a/test/integration/targets/jinja2_native_types/test_concatentation.yml b/test/integration/targets/jinja2_native_types/test_concatentation.yml
new file mode 100644
index 0000000..24a9038
--- /dev/null
+++ b/test/integration/targets/jinja2_native_types/test_concatentation.yml
@@ -0,0 +1,88 @@
+- name: add two ints
+ set_fact:
+ integer_sum: "{{ i_one + i_two }}"
+
+- assert:
+ that:
+ - 'integer_sum == 3'
+ - 'integer_sum|type_debug == "int"'
+
+- name: add casted string and int
+ set_fact:
+ integer_sum2: "{{ s_one|int + i_two }}"
+
+- assert:
+ that:
+ - 'integer_sum2 == 3'
+ - 'integer_sum2|type_debug == "int"'
+
+- name: concatenate int and string
+ set_fact:
+ string_sum: "'{{ [i_one, s_two]|join('') }}'"
+
+- assert:
+ that:
+ - string_sum == "'12'"
+ - 'string_sum|type_debug in ["str", "unicode"]'
+
+- name: add two lists
+ set_fact:
+ list_sum: "{{ list_one + list_two }}"
+
+- assert:
+ that:
+ - 'list_sum == ["one", "two", "three", "four"]'
+ - 'list_sum|type_debug == "list"'
+
+- name: add two lists, multi expression
+ set_fact:
+ list_sum_multi: "{{ list_one }} + {{ list_two }}"
+
+- assert:
+ that:
+ - 'list_sum_multi|type_debug in ["str", "unicode"]'
+
+- name: add two dicts
+ set_fact:
+ dict_sum: "{{ dict_one + dict_two }}"
+ ignore_errors: yes
+
+- assert:
+ that:
+ - 'dict_sum is undefined'
+
+- name: loop through list with strings
+ set_fact:
+ list_for_strings: "{% for x in list_one %}{{ x }}{% endfor %}"
+
+- assert:
+ that:
+ - 'list_for_strings == "onetwo"'
+ - 'list_for_strings|type_debug in ["str", "unicode"]'
+
+- name: loop through list with int
+ set_fact:
+ list_for_int: "{% for x in list_one_int %}{{ x }}{% endfor %}"
+
+- assert:
+ that:
+ - 'list_for_int == 1'
+ - 'list_for_int|type_debug == "int"'
+
+- name: loop through list with ints
+ set_fact:
+ list_for_ints: "{% for x in list_ints %}{{ x }}{% endfor %}"
+
+- assert:
+ that:
+ - 'list_for_ints == 42'
+ - 'list_for_ints|type_debug == "int"'
+
+- name: loop through list to create a new list
+ set_fact:
+ list_from_list: "[{% for x in list_ints %}{{ x }},{% endfor %}]"
+
+- assert:
+ that:
+ - 'list_from_list == [4, 2]'
+ - 'list_from_list|type_debug == "list"'