File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ pub fn cli() -> App {
7171                . requires ( "crate" ) 
7272                . conflicts_with_all ( & [ "git" ,  "path" ,  "index" ] ) , 
7373        ) 
74+         . arg_message_format ( ) 
7475        . after_help ( "Run `cargo help install` for more detailed information.\n " ) 
7576} 
7677
Original file line number Diff line number Diff line change @@ -54,6 +54,83 @@ fn simple() {
5454    assert_has_not_installed_exe ( cargo_home ( ) ,  "foo" ) ; 
5555} 
5656
57+ #[ cargo_test]  
58+ fn  simple_with_message_format ( )  { 
59+     pkg ( "foo" ,  "0.0.1" ) ; 
60+ 
61+     cargo_process ( "install foo --message-format=json" ) 
62+         . with_stderr ( 
63+             "\  
64+ 
65+ [DOWNLOADING] crates ... 
66+ [DOWNLOADED] foo v0.0.1 (registry [..]) 
67+ [INSTALLING] foo v0.0.1 
68+ [COMPILING] foo v0.0.1 
69+ [FINISHED] release [optimized] target(s) in [..] 
70+ [INSTALLING] [CWD]/home/.cargo/bin/foo[EXE] 
71+ [INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`) 
72+ [WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries 
73+ " , 
74+         ) 
75+         . with_json ( 
76+             r#" 
77+             { 
78+                 "reason": "compiler-artifact", 
79+                 "package_id": "foo 0.0.1 ([..])", 
80+                 "manifest_path": "[..]", 
81+                 "target": { 
82+                     "kind": [ 
83+                         "lib" 
84+                     ], 
85+                     "crate_types": [ 
86+                         "lib" 
87+                     ], 
88+                     "name": "foo", 
89+                     "src_path": "[..]/foo-0.0.1/src/lib.rs", 
90+                     "edition": "2015", 
91+                     "doc": true, 
92+                     "doctest": true, 
93+                     "test": true 
94+                 }, 
95+                 "profile": "{...}", 
96+                 "features": [], 
97+                 "filenames": "{...}", 
98+                 "executable": null, 
99+                 "fresh": false 
100+             } 
101+ 
102+             { 
103+                 "reason": "compiler-artifact", 
104+                 "package_id": "foo 0.0.1 ([..])", 
105+                 "manifest_path": "[..]", 
106+                 "target": { 
107+                     "kind": [ 
108+                         "bin" 
109+                     ], 
110+                     "crate_types": [ 
111+                         "bin" 
112+                     ], 
113+                     "name": "foo", 
114+                     "src_path": "[..]/foo-0.0.1/src/main.rs", 
115+                     "edition": "2015", 
116+                     "doc": true, 
117+                     "doctest": false, 
118+                     "test": true 
119+                 }, 
120+                 "profile": "{...}", 
121+                 "features": [], 
122+                 "filenames": "{...}", 
123+                 "executable": "[..]", 
124+                 "fresh": false 
125+             } 
126+ 
127+             {"reason":"build-finished","success":true} 
128+             "# , 
129+         ) 
130+         . run ( ) ; 
131+     assert_has_installed_exe ( cargo_home ( ) ,  "foo" ) ; 
132+ } 
133+ 
57134#[ cargo_test]  
58135fn  with_index ( )  { 
59136    pkg ( "foo" ,  "0.0.1" ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments