mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
parent
3e23bd30dd
commit
6db3c8cfc2
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
const (
|
||||
languageTemplate = " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} "
|
||||
noVersion = "NO VERSION"
|
||||
)
|
||||
|
||||
type loadContext func()
|
||||
|
@ -162,6 +163,7 @@ func (l *language) setVersion() error {
|
|||
var err error
|
||||
if command.getVersion == nil {
|
||||
if !l.env.HasCommand(command.executable) {
|
||||
lastError = errors.New(noVersion)
|
||||
continue
|
||||
}
|
||||
versionStr, err = l.env.RunCommand(command.executable, command.args...)
|
||||
|
|
|
@ -83,7 +83,7 @@ func TestLanguageFilesFoundButNoCommandAndVersionAndDisplayVersion(t *testing.T)
|
|||
}
|
||||
lang := bootStrapLanguageTest(args)
|
||||
assert.True(t, lang.Enabled())
|
||||
assert.Equal(t, "", lang.Error, "unicorn is not available")
|
||||
assert.Equal(t, noVersion, lang.Error, "unicorn is not available")
|
||||
}
|
||||
|
||||
func TestLanguageFilesFoundButNoCommandAndVersionAndDontDisplayVersion(t *testing.T) {
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestRuby(t *testing.T) {
|
|||
{Case: "Ruby files", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRubyFiles: true},
|
||||
{Case: "Rakefile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasRakeFile: true},
|
||||
{Case: "Gemfile", ExpectedString: "", ExpectedEnabled: true, FetchVersion: false, HasGemFile: true},
|
||||
{Case: "Gemfile with version", ExpectedString: "", ExpectedEnabled: true, FetchVersion: true, HasGemFile: true},
|
||||
{Case: "Gemfile with version", ExpectedString: noVersion, ExpectedEnabled: true, FetchVersion: true, HasGemFile: true},
|
||||
{Case: "No files with version", ExpectedString: "", ExpectedEnabled: false, FetchVersion: true},
|
||||
{
|
||||
Case: "Version with chruby",
|
||||
|
|
Loading…
Reference in a new issue