File tree Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -535,18 +535,16 @@ path = {}
535535 r#"[package]
536536name = "{}"
537537version = "0.1.0"
538- authors = [{}]{}
538+ authors = [{}]
539+ edition = {}
539540
540541[dependencies]
541542{}"# ,
542543 name,
543544 toml:: Value :: String ( author) ,
544545 match opts. edition {
545- Some ( edition) => {
546- let edition = toml:: Value :: String ( edition. to_string( ) ) ;
547- format!( "\n edition = {}" , edition)
548- }
549- None => String :: new( ) ,
546+ Some ( edition) => toml:: Value :: String ( edition. to_string( ) ) ,
547+ None => toml:: Value :: String ( "2018" . to_string( ) ) ,
550548 } ,
551549 cargotoml_path_specifier
552550 ) . as_bytes ( ) ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fn cargo_process(s: &str) -> Execs {
1313
1414#[ test]
1515fn simple_lib ( ) {
16- cargo_process ( "init --lib --vcs none" )
16+ cargo_process ( "init --lib --vcs none --edition 2015 " )
1717 . env ( "USER" , "foo" )
1818 . with_stderr ( "[CREATED] library project" )
1919 . run ( ) ;
@@ -29,7 +29,7 @@ fn simple_lib() {
2929fn simple_bin ( ) {
3030 let path = paths:: root ( ) . join ( "foo" ) ;
3131 fs:: create_dir ( & path) . unwrap ( ) ;
32- cargo_process ( "init --bin --vcs none" )
32+ cargo_process ( "init --bin --vcs none --edition 2015 " )
3333 . env ( "USER" , "foo" )
3434 . cwd ( & path)
3535 . with_stderr ( "[CREATED] binary (application) project" )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fn create_empty_gitconfig() {
1414
1515#[ test]
1616fn simple_lib ( ) {
17- cargo_process ( "new --lib foo --vcs none" )
17+ cargo_process ( "new --lib foo --vcs none --edition 2015 " )
1818 . env ( "USER" , "foo" )
1919 . with_stderr ( "[CREATED] library `foo` project" )
2020 . run ( ) ;
@@ -47,7 +47,7 @@ mod tests {
4747
4848#[ test]
4949fn simple_bin ( ) {
50- cargo_process ( "new --bin foo" )
50+ cargo_process ( "new --bin foo --edition 2015 " )
5151 . env ( "USER" , "foo" )
5252 . with_stderr ( "[CREATED] binary (application) `foo` project" )
5353 . run ( ) ;
@@ -75,7 +75,7 @@ fn both_lib_and_bin() {
7575
7676#[ test]
7777fn simple_git ( ) {
78- cargo_process ( "new --lib foo" ) . env ( "USER" , "foo" ) . run ( ) ;
78+ cargo_process ( "new --lib foo --edition 2015 " ) . env ( "USER" , "foo" ) . run ( ) ;
7979
8080 assert ! ( paths:: root( ) . is_dir( ) ) ;
8181 assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
@@ -474,6 +474,15 @@ fn new_with_edition_2018() {
474474 assert ! ( manifest. contains( "edition = \" 2018\" " ) ) ;
475475}
476476
477+ #[ test]
478+ fn new_default_edition ( ) {
479+ cargo_process ( "new foo" )
480+ . env ( "USER" , "foo" )
481+ . run ( ) ;
482+ let manifest = fs:: read_to_string ( paths:: root ( ) . join ( "foo/Cargo.toml" ) ) . unwrap ( ) ;
483+ assert ! ( manifest. contains( "edition = \" 2018\" " ) ) ;
484+ }
485+
477486#[ test]
478487fn new_with_bad_edition ( ) {
479488 cargo_process ( "new --edition something_else foo" )
You can’t perform that action at this time.
0 commit comments