#!/usr/bin/env bats

@test "Loading company loads oni-company" {
    run emacs -batch -l package -f package-initialize \
        -l company \
        -eval "(prin1 (featurep 'oni-company))"

    echo "$output"

    [[ "$output" == *"t" ]]
}

@test "Loading company diminishes company-mode" {
    run emacs -batch -l package -f package-initialize -l subr-x \
        -l company \
        -eval "(prin1 (string-empty-p (car (alist-get 'company-mode minor-mode-alist))))"

    echo "$output"

    [[ "$output" == *"t" ]]
}

@test "Reloading company diminishes company-mode" {
    run emacs -batch -l package -f package-initialize -l subr-x \
        -l company \
        -eval "(load-library \"company\")" \
        -eval "(prin1 (string-empty-p (car (alist-get 'company-mode minor-mode-alist))))"

    echo "$output"

    [[ "$output" == *"t" ]]
}

@test "Loading company-posframe diminishes company-posframe-mode" {
    run emacs -batch -l package -f package-initialize -l subr-x \
        -l company-posframe \
        -eval "(prin1 (string-empty-p (car (alist-get 'company-posframe-mode minor-mode-alist))))"

    echo "$output"

    [[ "$output" == *"t" ]]
}

@test "Reloading company-posframe diminishes company-posframe-mode" {
    run emacs -batch -l package -f package-initialize -l subr-x \
        -l company-posframe \
        -eval "(load-library \"company-posframe\")" \
        -eval "(prin1 (string-empty-p (car (alist-get 'company-posframe-mode minor-mode-alist))))"

    echo "$output"

    [[ "$output" == *"t" ]]
}