File tree 3 files changed +18
-11
lines changed
3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -535,18 +535,16 @@ path = {}
535
535
r#"[package]
536
536
name = "{}"
537
537
version = "0.1.0"
538
- authors = [{}]{}
538
+ authors = [{}]
539
+ edition = {}
539
540
540
541
[dependencies]
541
542
{}"# ,
542
543
name,
543
544
toml:: Value :: String ( author) ,
544
545
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( ) ) ,
550
548
} ,
551
549
cargotoml_path_specifier
552
550
) . as_bytes ( ) ,
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fn cargo_process(s: &str) -> Execs {
13
13
14
14
#[ test]
15
15
fn simple_lib ( ) {
16
- cargo_process ( "init --lib --vcs none" )
16
+ cargo_process ( "init --lib --vcs none --edition 2015 " )
17
17
. env ( "USER" , "foo" )
18
18
. with_stderr ( "[CREATED] library project" )
19
19
. run ( ) ;
@@ -29,7 +29,7 @@ fn simple_lib() {
29
29
fn simple_bin ( ) {
30
30
let path = paths:: root ( ) . join ( "foo" ) ;
31
31
fs:: create_dir ( & path) . unwrap ( ) ;
32
- cargo_process ( "init --bin --vcs none" )
32
+ cargo_process ( "init --bin --vcs none --edition 2015 " )
33
33
. env ( "USER" , "foo" )
34
34
. cwd ( & path)
35
35
. with_stderr ( "[CREATED] binary (application) project" )
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fn create_empty_gitconfig() {
14
14
15
15
#[ test]
16
16
fn simple_lib ( ) {
17
- cargo_process ( "new --lib foo --vcs none" )
17
+ cargo_process ( "new --lib foo --vcs none --edition 2015 " )
18
18
. env ( "USER" , "foo" )
19
19
. with_stderr ( "[CREATED] library `foo` project" )
20
20
. run ( ) ;
@@ -47,7 +47,7 @@ mod tests {
47
47
48
48
#[ test]
49
49
fn simple_bin ( ) {
50
- cargo_process ( "new --bin foo" )
50
+ cargo_process ( "new --bin foo --edition 2015 " )
51
51
. env ( "USER" , "foo" )
52
52
. with_stderr ( "[CREATED] binary (application) `foo` project" )
53
53
. run ( ) ;
@@ -75,7 +75,7 @@ fn both_lib_and_bin() {
75
75
76
76
#[ test]
77
77
fn simple_git ( ) {
78
- cargo_process ( "new --lib foo" ) . env ( "USER" , "foo" ) . run ( ) ;
78
+ cargo_process ( "new --lib foo --edition 2015 " ) . env ( "USER" , "foo" ) . run ( ) ;
79
79
80
80
assert ! ( paths:: root( ) . is_dir( ) ) ;
81
81
assert ! ( paths:: root( ) . join( "foo/Cargo.toml" ) . is_file( ) ) ;
@@ -474,6 +474,15 @@ fn new_with_edition_2018() {
474
474
assert ! ( manifest. contains( "edition = \" 2018\" " ) ) ;
475
475
}
476
476
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
+
477
486
#[ test]
478
487
fn new_with_bad_edition ( ) {
479
488
cargo_process ( "new --edition something_else foo" )
You can’t perform that action at this time.
0 commit comments