Skip to content

Commit 4d753da

Browse files
committed
Add failing test case
1 parent a06b719 commit 4d753da

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

scarb/tests/build_starknet_external_contracts.rs

+47
Original file line numberDiff line numberDiff line change
@@ -558,3 +558,50 @@ fn can_build_external_reexported_contracts() {
558558
]
559559
);
560560
}
561+
#[test]
562+
fn can_dedup_contract_reexports() {
563+
let t = TempDir::new().unwrap();
564+
let hello = t.child("hello");
565+
let world = t.child("world");
566+
567+
ProjectBuilder::start()
568+
.name("hello")
569+
.version("0.1.0")
570+
.manifest_extra(indoc! {r#"
571+
[lib]
572+
[[target.starknet-contract]]
573+
"#})
574+
.dep_starknet()
575+
.lib_cairo("pub mod a; pub use a::Balance;")
576+
.src("src/a.cairo", BALANCE_CONTRACT)
577+
.build(&hello);
578+
579+
ProjectBuilder::start()
580+
.name("world")
581+
.version("0.1.0")
582+
.dep("hello", hello)
583+
.manifest_extra(formatdoc! {r#"
584+
[[target.starknet-contract]]
585+
build-external-contracts = ["hello::*"]
586+
"#})
587+
.dep_starknet()
588+
.build(&world);
589+
590+
Scarb::quick_snapbox()
591+
.arg("build")
592+
.current_dir(&world)
593+
.assert()
594+
.success()
595+
.stdout_matches(indoc! {r#"
596+
[..] Compiling world v0.1.0 ([..]/Scarb.toml)
597+
[..] Finished `dev` profile target(s) in [..]
598+
"#});
599+
600+
assert_eq!(
601+
world.child("target/dev").files(),
602+
vec![
603+
"world.starknet_artifacts.json",
604+
"world_Balance.contract_class.json",
605+
]
606+
);
607+
}

0 commit comments

Comments
 (0)