feat(rust): add beta/dev/nightly to version string

This commit is contained in:
LNK LEO 2022-10-05 17:25:33 +08:00 committed by Jan De Dobbeleer
parent a7a59b8b01
commit 63e20bf53c
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]+)))`,
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

@ -14,6 +14,7 @@ func TestRust(t *testing.T) {
Version string
}{
{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)"},
}
for _, tc := range cases {
params := &mockedLanguageParams{