summary: bash completion

details: |
  Check the bash completion works in ubuntu core 22+

systems:
  - ubuntu-core-22-*

prepare: |
  snap install strace-static --edge
  cp ../../lib/snaps/test-snapd-complexion/meta/snap.yaml snap.yaml.bak
  cat <<EOF >>../../lib/snaps/test-snapd-complexion/meta/snap.yaml
  base: core22
  EOF
  cd ../../lib/snaps/test-snapd-complexion || exit 1
  snap try --devmode
  snap alias test-snapd-complexion cplx
  snap alias test-snapd-complexion.two cplx2

restore: |
  snap remove --purge test-snapd-complexion
  mv snap.yaml.bak ../../lib/snaps/test-snapd-complexion/meta/snap.yaml

execute: |
  for c in test-snapd-complexion test-snapd-complexion.two cplx cplx2; do
      python3 test-completion.py "${PWD}/test-rc" "${c}"
  done
