Skip to content

Commit ca21bf2

Browse files
roiferami3l
authored andcommitted
feat(dist): add support for parsing beta versions with tags in the toolchain
1 parent 1709a23 commit ca21bf2

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/dist/dist.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ impl FromStr for ParsedToolchainDesc {
181181
"beta",
182182
"stable",
183183
// Allow from 1.0.0 through to 9.999.99 with optional patch version
184-
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?",
184+
// and optional beta tag
185+
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?(?:-beta(?:\.\d{1,2})?)?",
185186
]
186187
.join("|")
187188
))
@@ -1185,6 +1186,25 @@ mod tests {
11851186
("1.6", ("1.6.0", None, None)),
11861187
("1.7", ("1.7.0", None, None)),
11871188
("1.8", ("1.8.0", None, None)),
1189+
// channels with beta tags
1190+
("0.0.0-beta", ("0.0.0-beta", None, None)),
1191+
("0.0.0-beta.1", ("0.0.0-beta.1", None, None)),
1192+
(
1193+
"0.0.0-beta.1-0000-00-00",
1194+
("0.0.0-beta.1", Some("0000-00-00"), None),
1195+
),
1196+
(
1197+
"0.0.0-beta.1-anything",
1198+
("0.0.0-beta.1", None, Some("anything")),
1199+
),
1200+
(
1201+
"0.0.0-beta-anything",
1202+
("0.0.0-beta", None, Some("anything")),
1203+
),
1204+
(
1205+
"0.0.0-beta.1-0000-00-00-any-other-thing",
1206+
("0.0.0-beta.1", Some("0000-00-00"), Some("any-other-thing")),
1207+
),
11881208
];
11891209

11901210
for (input, (channel, date, target)) in success_cases {

0 commit comments

Comments
 (0)