File tree Expand file tree Collapse file tree 7 files changed +33
-3
lines changed
tests/testsuite/cargo_add Expand file tree Collapse file tree 7 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,6 @@ Example uses:
8181 . takes_value ( true )
8282 . value_name ( "SPEC" )
8383 . help ( "Package to modify" ) ,
84- clap:: Arg :: new ( "offline" )
85- . long ( "offline" )
86- . help ( "Run without accessing the network" )
8784 ] )
8885 . arg_quiet ( )
8986 . arg_dry_run ( "Don't actually write the manifest" )
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ mod namever;
5656mod no_args;
5757mod no_default_features;
5858mod no_optional;
59+ mod offline_empty_cache;
5960mod optional;
6061mod overwrite_default_features;
6162mod overwrite_default_features_with_no_default_features;
Original file line number Diff line number Diff line change 1+ ../add-basic.in
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]
9+ fn offline_empty_cache ( ) {
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 ( "add" )
17+ . arg_line ( "--offline my-package" )
18+ . current_dir ( cwd)
19+ . assert ( )
20+ . code ( 101 )
21+ . stdout_matches_path ( curr_dir ! ( ) . join ( "stdout.log" ) )
22+ . stderr_matches_path ( curr_dir ! ( ) . join ( "stderr.log" ) ) ;
23+
24+ assert_ui ( ) . subset_matches ( curr_dir ! ( ) . join ( "out" ) , & project_root) ;
25+ }
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"
Original file line number Diff line number Diff line change 1+ error: the crate `my-package` could not be found in registry index.
You can’t perform that action at this time.
0 commit comments