#!/bin/sh

set -eu

echo "Testing which-key load..."

if nvim --headless \
  +'lua require("which-key").setup({})' \
  +'qa!'; then
  echo "OK which-key loaded without errors"
else
  echo "ERROR which-key failed to load"
  exit 1
fi

echo "Testing if :help which-key exists..."

if nvim --headless \
  +"silent! help which-key" \
  +"if &buftype ==# 'help' | qa! | else | cquit 1 | endif"; then
  echo "OK :help which-key exists"
else
  echo "ERROR :help which-key not found"
  exit 1
fi
