File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -237,3 +237,41 @@ fn duplicate_entries_in_lockfile() {
237237 )
238238 . run ( ) ;
239239}
240+
241+ #[ cargo_test]
242+ fn generate_lockfile_holds_lock_and_offline ( ) {
243+ Package :: new ( "syn" , "1.0.0" ) . publish ( ) ;
244+
245+ let p = project ( )
246+ . file (
247+ "Cargo.toml" ,
248+ r#"
249+ [package]
250+ name = "foo"
251+
252+ [dependencies]
253+ syn = "1.0"
254+ "# ,
255+ )
256+ . file ( "src/lib.rs" , "" )
257+ . build ( ) ;
258+
259+ p. cargo ( "generate-lockfile" )
260+ . with_stderr (
261+ "\
262+ [UPDATING] `[..]` index
263+ [LOCKING] 2 packages
264+ " ,
265+ )
266+ . run ( ) ;
267+
268+ p. cargo ( "generate-lockfile --offline" )
269+ . with_status ( 101 )
270+ . with_stderr_contains (
271+ "\
272+ [..]thread 'main' panicked[..]
273+ [..]package cache lock is not currently held[..]
274+ " ,
275+ )
276+ . run ( ) ;
277+ }
You can’t perform that action at this time.
0 commit comments