1
1
//! Tests for edition setting.
2
2
3
- #![ allow( deprecated) ]
4
-
5
3
use cargo:: core:: Edition ;
6
- use cargo_test_support:: { basic_lib_manifest, project} ;
4
+ use cargo_test_support:: { basic_lib_manifest, project, str } ;
7
5
8
6
#[ cargo_test]
9
7
fn edition_works_for_build_script ( ) {
@@ -66,21 +64,17 @@ fn edition_unstable_gated() {
66
64
67
65
p. cargo ( "check" )
68
66
. with_status ( 101 )
69
- . with_stderr ( & format ! (
67
+ . with_stderr_data ( format ! (
70
68
"\
71
- [ERROR] failed to parse manifest at `[.. ]/foo/Cargo.toml`
69
+ [ERROR] failed to parse manifest at `[ROOT ]/foo/Cargo.toml`
72
70
73
71
Caused by:
74
72
feature `edition{next}` is required
75
73
76
- The package requires the Cargo feature called `edition{next}`, \
77
- but that feature is not stabilized in this version of Cargo (1.[..]).
74
+ The package requires the Cargo feature called `edition{next}`, but that feature is not stabilized in this version of Cargo (1.[..]).
78
75
Consider trying a newer version of Cargo (this may require the nightly release).
79
- See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-{next} \
80
- for more information about the status of this feature.
81
- " ,
82
- next = next
83
- ) )
76
+ See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-{next} for more information about the status of this feature.
77
+ " ) )
84
78
. run ( ) ;
85
79
}
86
80
@@ -116,12 +110,11 @@ fn edition_unstable() {
116
110
117
111
p. cargo ( "check" )
118
112
. masquerade_as_nightly_cargo ( & [ "always_nightly" ] )
119
- . with_stderr (
120
- "\
121
- [CHECKING] foo [..]
122
- [FINISHED] [..]
123
- " ,
124
- )
113
+ . with_stderr_data ( str![ [ r#"
114
+ [CHECKING] foo v0.1.0 ([ROOT]/foo)
115
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
116
+
117
+ "# ] ] )
125
118
. run ( ) ;
126
119
}
127
120
@@ -140,14 +133,13 @@ fn unset_edition_with_unset_rust_version() {
140
133
. build ( ) ;
141
134
142
135
p. cargo ( "check -v" )
143
- . with_stderr (
144
- "\
136
+ . with_stderr_data ( str![ [ r#"
145
137
[WARNING] no edition set: defaulting to the 2015 edition while the latest is 2021
146
- [CHECKING] foo [..]
138
+ [CHECKING] foo v0.1.0 ([ROOT]/foo)
147
139
[RUNNING] `rustc [..] --edition=2015 [..]`
148
- [FINISHED] [..]
149
- " ,
150
- )
140
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
141
+
142
+ "# ] ] )
151
143
. run ( ) ;
152
144
}
153
145
@@ -167,13 +159,12 @@ fn unset_edition_works_with_no_newer_compatible_edition() {
167
159
. build ( ) ;
168
160
169
161
p. cargo ( "check -v" )
170
- . with_stderr (
171
- "\
172
- [CHECKING] foo [..]
162
+ . with_stderr_data ( str![ [ r#"
163
+ [CHECKING] foo v0.1.0 ([ROOT]/foo)
173
164
[RUNNING] `rustc [..] --edition=2015 [..]`
174
- [FINISHED] [..]
175
- " ,
176
- )
165
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
166
+
167
+ "# ] ] )
177
168
. run ( ) ;
178
169
}
179
170
@@ -193,13 +184,12 @@ fn unset_edition_works_on_old_msrv() {
193
184
. build ( ) ;
194
185
195
186
p. cargo ( "check -v" )
196
- . with_stderr (
197
- "\
187
+ . with_stderr_data ( str![ [ r#"
198
188
[WARNING] no edition set: defaulting to the 2015 edition while 2018 is compatible with `rust-version`
199
- [CHECKING] foo [..]
189
+ [CHECKING] foo v0.1.0 ([ROOT]/foo)
200
190
[RUNNING] `rustc [..] --edition=2015 [..]`
201
- [FINISHED] [..]
202
- " ,
203
- )
191
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
192
+
193
+ "# ] ] )
204
194
. run ( ) ;
205
195
}
0 commit comments