---
- name: Check argspec validation
  ansible.utils.fact_diff:
  ignore_errors: true
  register: result

- name: Assert
  ansible.builtin.assert:
    that: "{{ string in result.msg }}"
  loop:
    - "missing required arguments:"
    - before
    - after
  loop_control:
    loop_var: string
  when: "result.msg | type_debug != 'list'"

- name: Assert
  ansible.builtin.assert:
    that: "{{ msg in result.msg }}"
  vars:
    msg: "missing required arguments: after, before"
  when: "result.msg | type_debug == 'list'"

- name: Check argspec validation, skip_lines must be a dict
  ansible.utils.fact_diff:
    before: hostvars[inventory_hostname]
    after: hostvars[inventory_hostname]
    plugin:
      vars:
        skip_lines:
          a_dict: false
  ignore_errors: true
  register: result

- name: Assert
  ansible.builtin.assert:
    that: "{{ 'unable to convert to list' in result.msg }}"
  when: "result.msg | type_debug != 'list'"

- name: Assert
  ansible.builtin.assert:
    that: "{{ 'unable to convert to list' in result.msg[0] }}"
  when: "result.msg | type_debug == 'list'"
