File tree 15 files changed +98
-0
lines changed
tests/testsuite/cargo_add
rust_version_incompatible
15 files changed +98
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ mod quiet;
102
102
mod registry;
103
103
mod rename;
104
104
mod require_weak;
105
+ mod rust_version;
106
+ mod rust_version_incompatible;
105
107
mod sorted_table_with_dotted_item;
106
108
mod target;
107
109
mod target_cfg;
@@ -201,4 +203,14 @@ fn add_registry_packages(alt: bool) {
201
203
. feature ( "eyes" , & [ ] )
202
204
. feature ( "ears" , & [ ] )
203
205
. publish ( ) ;
206
+
207
+ // rust-version
208
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.1.0" )
209
+ . alternative ( alt)
210
+ . rust_version ( "1.66" )
211
+ . publish ( ) ;
212
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.2.1" )
213
+ . alternative ( alt)
214
+ . rust_version ( "1.72" )
215
+ . publish ( ) ;
204
216
}
Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+
3
+ [package ]
4
+ name = " cargo-list-test-fixture"
5
+ version = " 0.0.0"
6
+ rust-version = " 1.70"
Original file line number Diff line number Diff line change
1
+ use cargo_test_support:: compare:: assert_ui;
2
+ use cargo_test_support:: prelude:: * ;
3
+ use cargo_test_support:: Project ;
4
+
5
+ use crate :: cargo_add:: init_registry;
6
+ use cargo_test_support:: curr_dir;
7
+
8
+ #[ cargo_test( nightly, reason = "-Zmsrv-policy is unstable" ) ]
9
+ fn case ( ) {
10
+ init_registry ( ) ;
11
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
12
+ let project_root = project. root ( ) ;
13
+ let cwd = & project_root;
14
+
15
+ snapbox:: cmd:: Command :: cargo_ui ( )
16
+ . arg ( "-Zmsrv-policy" )
17
+ . arg ( "add" )
18
+ . arg_line ( "rust-version-user" )
19
+ . current_dir ( cwd)
20
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
21
+ . assert ( )
22
+ . success ( )
23
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
24
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
25
+
26
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
27
+ }
Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+
3
+ [package ]
4
+ name = " cargo-list-test-fixture"
5
+ version = " 0.0.0"
6
+ rust-version = " 1.70"
7
+
8
+ [dependencies ]
9
+ rust-version-user = " 0.1.0"
Original file line number Diff line number Diff line change
1
+ Updating `dummy-registry` index
2
+ warning: selecting older version of `rust-version-user` to satisfy the minimum supported rust version
3
+ Adding rust-version-user v0.1.0 to dependencies.
Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+
3
+ [package ]
4
+ name = " cargo-list-test-fixture"
5
+ version = " 0.0.0"
6
+ rust-version = " 1.56"
Original file line number Diff line number Diff line change
1
+ use cargo_test_support:: compare:: assert_ui;
2
+ use cargo_test_support:: prelude:: * ;
3
+ use cargo_test_support:: Project ;
4
+
5
+ use crate :: cargo_add:: init_registry;
6
+ use cargo_test_support:: curr_dir;
7
+
8
+ #[ cargo_test( nightly, reason = "-Zmsrv-policy is unstable" ) ]
9
+ fn case ( ) {
10
+ init_registry ( ) ;
11
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
12
+ let project_root = project. root ( ) ;
13
+ let cwd = & project_root;
14
+
15
+ snapbox:: cmd:: Command :: cargo_ui ( )
16
+ . arg ( "-Zmsrv-policy" )
17
+ . arg ( "add" )
18
+ . arg_line ( "rust-version-user" )
19
+ . current_dir ( cwd)
20
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
21
+ . assert ( )
22
+ . failure ( )
23
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
24
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
25
+
26
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
27
+ }
Original file line number Diff line number Diff line change
1
+ [workspace ]
2
+
3
+ [package ]
4
+ name = " cargo-list-test-fixture"
5
+ version = " 0.0.0"
6
+ rust-version = " 1.56"
Original file line number Diff line number Diff line change
1
+ Updating `dummy-registry` index
2
+ error: could not find version of crate `rust-version-user` that satisfies the minimum supported rust version
You can’t perform that action at this time.
0 commit comments