@@ -18,6 +18,9 @@ mod active;
1818mod builtin_attrs;
1919mod removed;
2020
21+ #[ cfg( test) ]
22+ mod tests;
23+
2124use rustc_span:: { edition:: Edition , symbol:: Symbol , Span } ;
2225use std:: fmt;
2326use std:: num:: NonZeroU32 ;
@@ -149,30 +152,3 @@ pub use builtin_attrs::{
149152 AttributeType , BuiltinAttribute , GatedCfg , BUILTIN_ATTRIBUTES , BUILTIN_ATTRIBUTE_MAP ,
150153} ;
151154pub use removed:: { REMOVED_FEATURES , STABLE_REMOVED_FEATURES } ;
152-
153- #[ cfg( test) ]
154- mod test {
155- use super :: UnstableFeatures ;
156-
157- #[ test]
158- fn rustc_bootstrap_parsing ( ) {
159- let is_bootstrap = |env, krate| {
160- std:: env:: set_var ( "RUSTC_BOOTSTRAP" , env) ;
161- matches ! ( UnstableFeatures :: from_environment( krate) , UnstableFeatures :: Cheat )
162- } ;
163- assert ! ( is_bootstrap( "1" , None ) ) ;
164- assert ! ( is_bootstrap( "1" , Some ( "x" ) ) ) ;
165- // RUSTC_BOOTSTRAP allows specifying a specific crate
166- assert ! ( is_bootstrap( "x" , Some ( "x" ) ) ) ;
167- // RUSTC_BOOTSTRAP allows multiple comma-delimited crates
168- assert ! ( is_bootstrap( "x,y,z" , Some ( "x" ) ) ) ;
169- assert ! ( is_bootstrap( "x,y,z" , Some ( "y" ) ) ) ;
170- // Crate that aren't specified do not get unstable features
171- assert ! ( !is_bootstrap( "x" , Some ( "a" ) ) ) ;
172- assert ! ( !is_bootstrap( "x,y,z" , Some ( "a" ) ) ) ;
173- assert ! ( !is_bootstrap( "x,y,z" , None ) ) ;
174-
175- // this is technically a breaking change, but there are no stability guarantees for RUSTC_BOOTSTRAP
176- assert ! ( !is_bootstrap( "0" , None ) ) ;
177- }
178- }
0 commit comments