summaryrefslogtreecommitdiff
path: root/test/integration/targets/jinja2_native_types/test_casting.yml
blob: e66489ff5b1148da2bcb6582ee18f4856106a035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- name: cast things to other things
  set_fact:
      int_to_str: "'{{ i_two }}'"
      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 }}"

- assert:
    that:
        - 'int_to_str == "2"'
        - 'int_to_str|type_debug in ["str", "unicode"]'
        - '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"'