#!/usr/bin/env bats

@test "Opening a .groovy file loads oni-groovy" {
    run emacs -batch -l package -f package-initialize \
        -visit test.groovy \
        -eval "(prin1 (featurep 'oni-groovy))"

    echo "$output"

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

@test "Opening a Jenkinsfile loads oni-groovy" {
    run emacs -batch -l package -f package-initialize \
        -visit Jenkinsfile \
        -eval "(prin1 (featurep 'oni-groovy))"

    echo "$output"

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

@test "Opening a .pipeline file loads oni-groovy" {
    run emacs -batch -l package -f package-initialize \
        -visit test.pipeline \
        -eval "(prin1 (featurep 'oni-groovy))"

    echo "$output"

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

@test "Opening a .pipeline file loads jenkinsfile-mode" {
    run emacs -batch -l package -f package-initialize \
        -visit "test.pipeline" \
        -eval "(prin1 major-mode)"

    echo "$output"

    [[ "$output" == *"jenkinsfile-mode" ]]
}