mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
fix: adoptopenjdk 16 version parsing
This commit is contained in:
parent
85fb7611bc
commit
513794af46
|
@ -11,7 +11,7 @@ func (j *java) string() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *java) init(props *properties, env environmentInfo) {
|
func (j *java) init(props *properties, env environmentInfo) {
|
||||||
javaRegex := `\((?P<version>(?P<major>[0-9]+)\.(?P<minor>[0-9]+)\.(?P<patch>[0-9]+)).*\).*(?:built|from)`
|
javaRegex := `(?: JRE) \((?P<version>(?P<major>[0-9]+)(?:\.(?P<minor>[0-9]+))?(?:\.(?P<patch>[0-9]+))?).*\),`
|
||||||
javaCmd := &cmd{
|
javaCmd := &cmd{
|
||||||
executable: "java",
|
executable: "java",
|
||||||
args: []string{"-Xinternalversion"},
|
args: []string{"-Xinternalversion"},
|
||||||
|
|
|
@ -32,6 +32,20 @@ func TestJava(t *testing.T) {
|
||||||
JavaHomeVersion: "OpenJDK 64-Bit Server VM (25.275-b01) for bsd-amd64 JRE (1.7.0_275-b01), built on Nov 9 2020 12:07:35 by \"jenkins\" with gcc 4.2.1",
|
JavaHomeVersion: "OpenJDK 64-Bit Server VM (25.275-b01) for bsd-amd64 JRE (1.7.0_275-b01), built on Nov 9 2020 12:07:35 by \"jenkins\" with gcc 4.2.1",
|
||||||
Version: "OpenJDK 64-Bit Server VM (25.275-b01) for bsd-amd64 JRE (1.8.0_275-b01), built on Nov 9 2020 12:07:35 by \"jenkins\" with gcc 4.2.1",
|
Version: "OpenJDK 64-Bit Server VM (25.275-b01) for bsd-amd64 JRE (1.8.0_275-b01), built on Nov 9 2020 12:07:35 by \"jenkins\" with gcc 4.2.1",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Case: "openjdk version \"15.0.2\" 2021-01-19",
|
||||||
|
ExpectedString: "15.0.2",
|
||||||
|
JavaHomeEnabled: true,
|
||||||
|
JavaHomeVersion: "OpenJDK 64-Bit Server VM (15.0.2+7) for windows-amd64 JRE (15.0.2+7), built on Jan 21 2021 05:54:57 by \"\" with MS VC++ 15.9 (VS2017)",
|
||||||
|
Version: "OpenJDK 64-Bit Server VM (15.0.2+7) for windows-amd64 JRE (15.0.2+7), built on Jan 21 2021 05:54:57 by \"\" with MS VC++ 15.9 (VS2017)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Case: "openjdk version \"16\" 2021-03-16",
|
||||||
|
ExpectedString: "16",
|
||||||
|
JavaHomeEnabled: true,
|
||||||
|
JavaHomeVersion: "OpenJDK 64-Bit Server VM (16+36) for windows-amd64 JRE (16+36), built on Mar 11 2021 10:56:33 by \"\" with MS VC++ 16.7 (VS2019)",
|
||||||
|
Version: "OpenJDK 64-Bit Server VM (16+36) for windows-amd64 JRE (16+36), built on Mar 11 2021 10:56:33 by \"\" with MS VC++ 16.7 (VS2019)",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
env := new(MockedEnvironment)
|
env := new(MockedEnvironment)
|
||||||
|
|
Loading…
Reference in a new issue