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 33use std:: fmt:: { self , Write } ;
44
55use crate :: messages:: raw_rustc_output;
6+ use cargo_test_support:: compare;
67use cargo_test_support:: install:: exe;
78use cargo_test_support:: paths:: CargoPathExt ;
89use cargo_test_support:: registry:: Package ;
@@ -1519,3 +1520,40 @@ fn versionless_package() {
15191520 )
15201521 . run ( ) ;
15211522}
1523+
1524+ #[ cargo_test]
1525+ fn pkgid_querystring_works ( ) {
1526+ let git_project = git:: new ( "gitdep" , |p| {
1527+ p. file ( "Cargo.toml" , & basic_manifest ( "gitdep" , "1.0.0" ) )
1528+ . file ( "src/lib.rs" , "" )
1529+ } ) ;
1530+ let p = project ( )
1531+ . file (
1532+ "Cargo.toml" ,
1533+ & format ! (
1534+ r#"
1535+ [package]
1536+ name = "foo"
1537+
1538+ [dependencies]
1539+ gitdep = {{ git = "{}", branch = "master" }}
1540+ "# ,
1541+ git_project. url( )
1542+ ) ,
1543+ )
1544+ . file ( "src/lib.rs" , "" )
1545+ . build ( ) ;
1546+
1547+ p. cargo ( "generate-lockfile" ) . run ( ) ;
1548+
1549+ let output = p. cargo ( "pkgid" ) . arg ( "gitdep" ) . exec_with_output ( ) . unwrap ( ) ;
1550+ let gitdep_pkgid = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
1551+ let gitdep_pkgid = gitdep_pkgid. trim ( ) ;
1552+ compare:: assert_match_exact ( "git+file://[..]/gitdep?branch=master#1.0.0" , & gitdep_pkgid) ;
1553+
1554+ p. cargo ( "build -p" )
1555+ . arg ( gitdep_pkgid)
1556+ . with_status ( 101 )
1557+ . with_stderr ( "[ERROR] package pattern(s) `git+file:///[..]/gitdep?branch=master#1.0.0` not found in workspace `[CWD]`" )
1558+ . run ( ) ;
1559+ }
You can’t perform that action at this time.
0 commit comments