File tree 29 files changed +213
-0
lines changed
tests/testsuite/cargo_add
rust_version_incompatible 29 files changed +213
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ mod quiet;
102
102
mod registry;
103
103
mod rename;
104
104
mod require_weak;
105
+ mod rust_version_ignore;
106
+ mod rust_version_incompatible;
107
+ mod rust_version_latest;
108
+ mod rust_version_older;
105
109
mod sorted_table_with_dotted_item;
106
110
mod target;
107
111
mod target_cfg;
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.68"
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
+
12
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.1.0" )
13
+ . rust_version ( "1.66" )
14
+ . publish ( ) ;
15
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.2.1" )
16
+ . rust_version ( "1.72" )
17
+ . publish ( ) ;
18
+
19
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
20
+ let project_root = project. root ( ) ;
21
+ let cwd = & project_root;
22
+
23
+ snapbox:: cmd:: Command :: cargo_ui ( )
24
+ . arg ( "-Zmsrv-policy" )
25
+ . arg ( "add" )
26
+ . arg ( "--ignore-rust-version" )
27
+ . arg_line ( "rust-version-user" )
28
+ . current_dir ( cwd)
29
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
30
+ . assert ( )
31
+ . success ( )
32
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
33
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
34
+
35
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
36
+ }
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.68"
7
+
8
+ [dependencies ]
9
+ rust-version-user = " 0.2.1"
Original file line number Diff line number Diff line change
1
+ Updating `dummy-registry` index
2
+ Adding rust-version-user v0.2.1 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
+
12
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.1.0" )
13
+ . rust_version ( "1.66" )
14
+ . publish ( ) ;
15
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.2.1" )
16
+ . rust_version ( "1.72" )
17
+ . publish ( ) ;
18
+
19
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
20
+ let project_root = project. root ( ) ;
21
+ let cwd = & project_root;
22
+
23
+ snapbox:: cmd:: Command :: cargo_ui ( )
24
+ . arg ( "-Zmsrv-policy" )
25
+ . arg ( "add" )
26
+ . arg_line ( "rust-version-user" )
27
+ . current_dir ( cwd)
28
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
29
+ . assert ( )
30
+ . failure ( )
31
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
32
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
33
+
34
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
35
+ }
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 this package's rust-version
3
+ help: use `--ignore-rust-version` to override this behavior
4
+ note: the lowest rust-version available for `rust-version-user` is 1.66
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.72"
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
+
12
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.1.0" )
13
+ . rust_version ( "1.66" )
14
+ . publish ( ) ;
15
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.2.1" )
16
+ . rust_version ( "1.72" )
17
+ . publish ( ) ;
18
+
19
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
20
+ let project_root = project. root ( ) ;
21
+ let cwd = & project_root;
22
+
23
+ snapbox:: cmd:: Command :: cargo_ui ( )
24
+ . arg ( "-Zmsrv-policy" )
25
+ . arg ( "add" )
26
+ . arg_line ( "rust-version-user" )
27
+ . current_dir ( cwd)
28
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
29
+ . assert ( )
30
+ . success ( )
31
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
32
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
33
+
34
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
35
+ }
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.72"
7
+
8
+ [dependencies ]
9
+ rust-version-user = " 0.2.1"
Original file line number Diff line number Diff line change
1
+ Updating `dummy-registry` index
2
+ Adding rust-version-user v0.2.1 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.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
+
12
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.1.0" )
13
+ . rust_version ( "1.66" )
14
+ . publish ( ) ;
15
+ cargo_test_support:: registry:: Package :: new ( "rust-version-user" , "0.2.1" )
16
+ . rust_version ( "1.72" )
17
+ . publish ( ) ;
18
+
19
+ let project = Project :: from_template ( curr_dir ! ( ) . join ( "in" ) ) ;
20
+ let project_root = project. root ( ) ;
21
+ let cwd = & project_root;
22
+
23
+ snapbox:: cmd:: Command :: cargo_ui ( )
24
+ . arg ( "-Zmsrv-policy" )
25
+ . arg ( "add" )
26
+ . arg_line ( "rust-version-user" )
27
+ . current_dir ( cwd)
28
+ . masquerade_as_nightly_cargo ( & [ "msrv-policy" ] )
29
+ . assert ( )
30
+ . success ( )
31
+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
32
+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
33
+
34
+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
35
+ }
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 this package's rust-version (use `--ignore-rust-version` to override)
3
+ Adding rust-version-user v0.1.0 to dependencies.
You can’t perform that action at this time.
0 commit comments