Open
Description
Discussion: this test is kinda testing multiple things and bears multiple responsibilities, we may want to split this test up:
- We wish to exercise the feature-gating of the unstable feature itself. That is, I would expect
#[cfg(version("1.49.0"))]
to be this feature-gate test without#![feature(cfg_version)]
and the user should get the "this is unstable" error message. - We wish to exercise the wellformed-ness of the values passed to
version(..)
as a sort of "interface". In particular, I'd consider splitting tests for:- The syntactical wellformedness:
- Proper name-with-paren-value form (
version(..)
): known vs unknown major version string "1", known vs unknown major-minor version string, known vs unknown major-minor-patch version string, empty version string, some "hello world" nonsense version string. - Invalid forms (
version = ".."
or bareversion
).
- Proper name-with-paren-value form (
- The semantic wellformedness of the version string: major version (e.g. "1"), major-minor version (e.g. "1.1"), major-minor-patch (e.g. "1.1.1"), and also known-vs-unknown variants for them.
- The syntactical wellformedness:
- I'd also check that if user manually specifies
--cfg version
or--cfg version=".."
they are not affected and usable with or without feature gate (I need to double-check that).
This is also fine as a follow-up, I can probably write those coverage.
Originally posted by @jieyouxu in #141413 (comment)