File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 3
3
use std:: fmt:: { self , Write } ;
4
4
5
5
use crate :: messages:: raw_rustc_output;
6
+ use cargo_test_support:: compare;
6
7
use cargo_test_support:: install:: exe;
7
8
use cargo_test_support:: paths:: CargoPathExt ;
8
9
use cargo_test_support:: registry:: Package ;
@@ -1519,3 +1520,40 @@ fn versionless_package() {
1519
1520
)
1520
1521
. run ( ) ;
1521
1522
}
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