mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-29 12:01:07 -08:00
parent
71f81a0b79
commit
8dbdc160db
|
@ -76,7 +76,8 @@ func (n *Node) matchesVersionFile() (string, bool) {
|
|||
n.language.version.Patch,
|
||||
)
|
||||
|
||||
version := strings.TrimPrefix(fileVersion, "v")
|
||||
version := strings.TrimSpace(fileVersion)
|
||||
version = strings.TrimPrefix(version, "v")
|
||||
|
||||
return version, regex.MatchString(re, fileVersion)
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ func TestNodeMatchesVersionFile(t *testing.T) {
|
|||
}{
|
||||
{Case: "no file context", Expected: true, RCVersion: ""},
|
||||
{Case: "version match", Expected: true, ExpectedVersion: "1.2.3", RCVersion: "1.2.3"},
|
||||
{Case: "version match with newline", Expected: true, ExpectedVersion: "1.2.3", RCVersion: "1.2.3\n"},
|
||||
{Case: "version mismatch", Expected: false, ExpectedVersion: "3.2.1", RCVersion: "3.2.1"},
|
||||
{Case: "version match in other format", Expected: true, ExpectedVersion: "1.2.3", RCVersion: "v1.2.3"},
|
||||
{Case: "version match without patch", Expected: true, ExpectedVersion: "1.2", RCVersion: "1.2"},
|
||||
|
|
Loading…
Reference in a new issue