mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
parent
6dc9ded7a4
commit
c7db86ed4c
|
@ -157,6 +157,9 @@ func (l *language) setVersion() error {
|
||||||
l.exitCode = exitErr.exitCode
|
l.exitCode = exitErr.exitCode
|
||||||
return fmt.Errorf("err executing %s with %s", command.executable, command.args)
|
return fmt.Errorf("err executing %s with %s", command.executable, command.args)
|
||||||
}
|
}
|
||||||
|
if version == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
err = command.parse(version)
|
err = command.parse(version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("err parsing info from %s with %s", command.executable, version)
|
return fmt.Errorf("err parsing info from %s with %s", command.executable, version)
|
||||||
|
|
|
@ -243,6 +243,29 @@ func TestLanguageEnabledMissingCommand(t *testing.T) {
|
||||||
assert.Equal(t, "", lang.string(), "unicorn is available and uni and corn files are found")
|
assert.Equal(t, "", lang.string(), "unicorn is available and uni and corn files are found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLanguageEnabledNoVersionData(t *testing.T) {
|
||||||
|
props := map[Property]interface{}{
|
||||||
|
DisplayVersion: true,
|
||||||
|
}
|
||||||
|
args := &languageArgs{
|
||||||
|
commands: []*cmd{
|
||||||
|
{
|
||||||
|
executable: "uni",
|
||||||
|
args: []string{"--version"},
|
||||||
|
regex: `(?:Python (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+))))`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions: []string{uni, corn},
|
||||||
|
enabledExtensions: []string{uni, corn},
|
||||||
|
enabledCommands: []string{"uni"},
|
||||||
|
version: "",
|
||||||
|
properties: props,
|
||||||
|
}
|
||||||
|
lang := bootStrapLanguageTest(args)
|
||||||
|
assert.True(t, lang.enabled())
|
||||||
|
assert.Equal(t, "", lang.string())
|
||||||
|
}
|
||||||
|
|
||||||
func TestLanguageEnabledMissingCommandCustomText(t *testing.T) {
|
func TestLanguageEnabledMissingCommandCustomText(t *testing.T) {
|
||||||
expected := "missing"
|
expected := "missing"
|
||||||
props := map[Property]interface{}{
|
props := map[Property]interface{}{
|
||||||
|
|
Loading…
Reference in a new issue