package shell

import (
	"testing"
)

func TestGuessFish(t *testing.T) {
	if Guess("/usr/local/bin/fish") != Fish {
		t.Errorf("Expected /usr/local/bin/fish to match the fish shell")
	}
}

func TestFishCompiles(t *testing.T) {
	defer func() {
		if r := recover(); r != nil {
			t.Errorf("Expected Fish to be a valid template: \n%s", r)
		}
	}()

	Fish.MustCompile("j")
}

func TestGuessZsh(t *testing.T) {
	if Guess("/bin/zsh") != Zsh {
		t.Errorf("Expected /bin/zsh to match the zsh shell")
	}
}

func TestZshCompiles(t *testing.T) {
	defer func() {
		if r := recover(); r != nil {
			t.Errorf("Expected Zsh to be a valid template: \n%s", r)
		}
	}()

	Zsh.MustCompile("j")
}

func TestGuessBash(t *testing.T) {
	if Guess("/bin/bash") != Bash {
		t.Errorf("Expected /bin/bash to match the bash shell")
	}

	if Guess("/bin/sh") != Bash {
		// Its the most common one so fullback to it.
		t.Errorf("Expected unknown shells to match the bash shell")
	}
}

func TestBashCompiles(t *testing.T) {
	defer func() {
		if r := recover(); r != nil {
			t.Errorf("Expected Bash to be a valid template: \n%s", r)
		}
	}()

	Bash.MustCompile("j")
}

package shell

import (
	"testing"

	"github.com/gsamokovarov/assert"
)

func TestGuessFish(t *testing.T) {
	assert.Equal(t, Fish, Guess("/usr/local/bin/fish"))
}

func TestFishCompiles(t *testing.T) {
	Fish.MustCompile("j")
}

func TestGuessZsh(t *testing.T) {
	assert.Equal(t, Zsh, Guess("/usr/zsh"))
}

func TestZshCompiles(t *testing.T) {
	Zsh.MustCompile("j")
}

func TestGuessBash(t *testing.T) {
	assert.Equal(t, Bash, Guess("/bin/bash"))
	assert.Equal(t, Bash, Guess("/bin/sh"))
}

func TestBashCompiles(t *testing.T) {
	Bash.MustCompile("j")
}

Use gsamokovarov/assert in the shell testing
Use gsamokovarov/assert in the shell testing
