---
- name: "Validate argspec {{ parser }}"
  ansible.utils.cli_parse:
    text: ""
    parser:
      name: ansible.utils.json
      template_path: ""
      command: ls
  register: argfail
  ignore_errors: true

- name: "Check argspec fail {{ parser }}"
  ansible.builtin.assert:
    that: "{{ msg in argfail.errors }}"
  vars:
    msg: "parameters are mutually exclusive: command|template_path found in parser"

- name: "Validate argspec {{ parser }}"
  ansible.utils.cli_parse:
    text: ""
    command: ls
    parser:
      name: ansible.utils.json
      command: ""
  register: argfail
  ignore_errors: true

- name: "Check argspec fail {{ parser }}"
  ansible.builtin.assert:
    that: "{{ msg in argfail.errors }}"
  vars:
    msg: "parameters are mutually exclusive: command|text"

- name: "Validate argspec {{ parser }}"
  ansible.utils.cli_parse:
    parser:
      name: ansible.netcommon.json
      command: ""
  register: argfail
  ignore_errors: true

- name: "Check argspec fail {{ parser }}"
  ansible.builtin.assert:
    that: "{{ msg in argfail.errors }}"
  vars:
    msg: "one of the following is required: command, text"

- name: "Validate argspec {{ parser }}"
  ansible.utils.cli_parse:
    text: ""
    parser:
      name: not_fqdn
      command: ""
  register: argfail
  ignore_errors: true

- name: "Check arspec fail {{ parser }}"
  ansible.builtin.assert:
    that: "{{ msg in argfail.msg }}"
  vars:
    msg: "Parser name should be provided as a full name including collection"
