@@ -437,3 +437,156 @@ pub fn wbg_test_node() -> Fixture {
437
437
) ;
438
438
fixture
439
439
}
440
+
441
+ pub fn transitive_dependencies ( ) -> Fixture {
442
+ fn project_main_fixture ( fixture : & mut Fixture ) {
443
+ fixture. file ( PathBuf :: from ( "main/README" ) , "# Main Fixture\n " ) ;
444
+ fixture. file (
445
+ PathBuf :: from ( "main/Cargo.toml" ) ,
446
+ r#"
447
+ [package]
448
+ authors = ["The wasm-pack developers"]
449
+ description = "so awesome rust+wasm package"
450
+ license = "WTFPL"
451
+ name = "main_project"
452
+ repository = "https://github.com/rustwasm/wasm-pack.git"
453
+ version = "0.1.0"
454
+
455
+ [lib]
456
+ crate-type = ["cdylib"]
457
+
458
+ [dependencies]
459
+ wasm-bindgen = "=0.2.21"
460
+ project_a = { path = "../project_a" }
461
+ project_b = { path = "../project_b" }
462
+
463
+ [dev-dependencies]
464
+ wasm-bindgen-test = "=0.2.21"
465
+ "# ,
466
+ ) ;
467
+ fixture. file (
468
+ PathBuf :: from ( "main/src/lib.rs" ) ,
469
+ r#"
470
+ extern crate wasm_bindgen;
471
+ use wasm_bindgen::prelude::*;
472
+
473
+ // Import the `window.alert` function from the Web.
474
+ #[wasm_bindgen]
475
+ extern {
476
+ fn alert(s: &str);
477
+ }
478
+
479
+ // Export a `greet` function from Rust to JavaScript, that alerts a
480
+ // hello message.
481
+ #[wasm_bindgen]
482
+ pub fn greet(name: &str) {
483
+ alert(&format!("Hello, {}!", name));
484
+ }
485
+ "# ,
486
+ ) ;
487
+ }
488
+
489
+ fn project_a_fixture ( fixture : & mut Fixture ) {
490
+ fixture. file (
491
+ PathBuf :: from ( "project_a/README" ) ,
492
+ "# Project Alpha Fixture\n " ,
493
+ ) ;
494
+ fixture. file (
495
+ PathBuf :: from ( "project_a/Cargo.toml" ) ,
496
+ r#"
497
+ [package]
498
+ authors = ["The wasm-pack developers"]
499
+ description = "so awesome rust+wasm package"
500
+ license = "WTFPL"
501
+ name = "project_a"
502
+ repository = "https://github.com/rustwasm/wasm-pack.git"
503
+ version = "0.1.0"
504
+
505
+ [lib]
506
+ crate-type = ["cdylib"]
507
+
508
+ [dependencies]
509
+ wasm-bindgen = "=0.2.21"
510
+ project_b = { path = "../project_b" }
511
+
512
+ [dev-dependencies]
513
+ wasm-bindgen-test = "=0.2.21"
514
+ "# ,
515
+ ) ;
516
+ fixture. file (
517
+ PathBuf :: from ( "project_a/src/lib.rs" ) ,
518
+ r#"
519
+ extern crate wasm_bindgen;
520
+ // extern crate project_b;
521
+ use wasm_bindgen::prelude::*;
522
+
523
+ // Import the `window.alert` function from the Web.
524
+ #[wasm_bindgen]
525
+ extern {
526
+ fn alert(s: &str);
527
+ }
528
+
529
+ // Export a `greet` function from Rust to JavaScript, that alerts a
530
+ // hello message.
531
+ #[wasm_bindgen]
532
+ pub fn greet(name: &str) {
533
+ alert(&format!("Hello, {}!", name));
534
+ }
535
+ "# ,
536
+ ) ;
537
+ }
538
+
539
+ fn project_b_fixture ( fixture : & mut Fixture ) {
540
+ fixture. file (
541
+ PathBuf :: from ( "project_b/README" ) ,
542
+ "# Project Beta Fixture\n " ,
543
+ ) ;
544
+ fixture. file (
545
+ PathBuf :: from ( "project_b/Cargo.toml" ) ,
546
+ r#"
547
+ [package]
548
+ authors = ["The wasm-pack developers"]
549
+ description = "so awesome rust+wasm package"
550
+ license = "WTFPL"
551
+ name = "project_b"
552
+ repository = "https://github.com/rustwasm/wasm-pack.git"
553
+ version = "0.1.0"
554
+
555
+ [lib]
556
+ crate-type = ["cdylib"]
557
+
558
+ [dependencies]
559
+ wasm-bindgen = "=0.2.21"
560
+
561
+ [dev-dependencies]
562
+ wasm-bindgen-test = "=0.2.21"
563
+ "# ,
564
+ ) ;
565
+ fixture. file (
566
+ PathBuf :: from ( "project_b/src/lib.rs" ) ,
567
+ r#"
568
+ extern crate wasm_bindgen;
569
+ use wasm_bindgen::prelude::*;
570
+
571
+ // Import the `window.alert` function from the Web.
572
+ #[wasm_bindgen]
573
+ extern {
574
+ fn alert(s: &str);
575
+ }
576
+
577
+ // Export a `greet` function from Rust to JavaScript, that alerts a
578
+ // hello message.
579
+ #[wasm_bindgen]
580
+ pub fn greet(name: &str) {
581
+ alert(&format!("Hello, {}!", name));
582
+ }
583
+ "# ,
584
+ ) ;
585
+ }
586
+
587
+ let mut fixture = Fixture :: new ( ) ;
588
+ project_b_fixture ( & mut fixture) ;
589
+ project_a_fixture ( & mut fixture) ;
590
+ project_main_fixture ( & mut fixture) ;
591
+ fixture
592
+ }
0 commit comments