fix(rust): optional version metadata

resolves #3001
This commit is contained in:
Jan De Dobbeleer 2022-10-23 14:33:53 +02:00 committed by Jan De Dobbeleer
parent e884a6afe8
commit 0e6cc95a0b
2 changed files with 2 additions and 1 deletions

View file

@ -22,7 +22,7 @@ func (r *Rust) Init(props properties.Properties, env environment.Environment) {
{
executable: "rustc",
args: []string{"--version"},
regex: `rustc (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+))(-(?P<prerelease>[a-z]+))?) (\((?P<buildmetadata>[0-9a-f]+ [0-9]+-[0-9]+-[0-9]+)\))`,
regex: `rustc (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+))(-(?P<prerelease>[a-z]+))?)(( \((?P<buildmetadata>[0-9a-f]+ [0-9]+-[0-9]+-[0-9]+)\))?)`,
},
},
}

View file

@ -13,6 +13,7 @@ func TestRust(t *testing.T) {
ExpectedString string
Version string
}{
{Case: "Rust 1.64.0", ExpectedString: "1.64.0", Version: "rustc 1.64.0"},
{Case: "Rust 1.53.0", ExpectedString: "1.53.0", Version: "rustc 1.53.0 (4369396ce 2021-04-27)"},
{Case: "Rust 1.66.0", ExpectedString: "1.66.0-nightly", Version: "rustc 1.66.0-nightly (01af5040f 2022-10-04)"},
}