summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/jinja2_native_types/test_casting.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/jinja2_native_types/test_casting.yml
parentInitial commit. (diff)
downloadansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz
ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/jinja2_native_types/test_casting.yml')
-rw-r--r--test/integration/targets/jinja2_native_types/test_casting.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/integration/targets/jinja2_native_types/test_casting.yml b/test/integration/targets/jinja2_native_types/test_casting.yml
new file mode 100644
index 0000000..5e9c76d
--- /dev/null
+++ b/test/integration/targets/jinja2_native_types/test_casting.yml
@@ -0,0 +1,31 @@
+- name: cast things to other things
+ set_fact:
+ int_to_str: "'{{ i_two }}'"
+ int_to_str2: "{{ i_two | string }}"
+ str_to_int: "{{ s_two|int }}"
+ dict_to_str: "'{{ dict_one }}'"
+ list_to_str: "'{{ list_one }}'"
+ int_to_bool: "{{ i_one|bool }}"
+ str_true_to_bool: "{{ s_true|bool }}"
+ str_false_to_bool: "{{ s_false|bool }}"
+ list_to_json_str: "{{ list_one | to_json }}"
+ list_to_yaml_str: "{{ list_one | to_yaml }}"
+
+- assert:
+ that:
+ - int_to_str == "'2'"
+ - 'int_to_str|type_debug in ["str", "unicode"]'
+ - 'int_to_str2 == "2"'
+ - 'int_to_str2|type_debug in ["NativeJinjaText"]'
+ - 'str_to_int == 2'
+ - 'str_to_int|type_debug == "int"'
+ - 'dict_to_str|type_debug in ["str", "unicode"]'
+ - 'list_to_str|type_debug in ["str", "unicode"]'
+ - 'int_to_bool is sameas true'
+ - 'int_to_bool|type_debug == "bool"'
+ - 'str_true_to_bool is sameas true'
+ - 'str_true_to_bool|type_debug == "bool"'
+ - 'str_false_to_bool is sameas false'
+ - 'str_false_to_bool|type_debug == "bool"'
+ - 'list_to_json_str|type_debug in ["NativeJinjaText"]'
+ - 'list_to_yaml_str|type_debug in ["NativeJinjaText"]'