mirror of
https://github.com/diodeinc/pcb.git
synced 2026-09-14 20:17:19 +08:00
e852477546
* Initial release * cargo-dist * build and test CI * update ubuntu workflow * fmt * ubuntu: install deps * clippy: 0.1.88 fixes * format * install clippy * Update README.md * Don't run cargo-dist on PRs
76 lines
1.2 KiB
Rust
76 lines
1.2 KiB
Rust
mod common;
|
|
use common::TestProject;
|
|
|
|
#[test]
|
|
fn snapshot_io_and_config_placeholders() {
|
|
let env = TestProject::new();
|
|
|
|
env.add_file(
|
|
"my_sub.star",
|
|
r#"
|
|
# Declare input placeholders
|
|
pwr = io("pwr", Net)
|
|
baud = config("baud", int)
|
|
|
|
# Very small dummy component that ties to the power net so that the schematic is non-empty.
|
|
Component(
|
|
name = "comp0",
|
|
footprint = "TEST:0402",
|
|
pin_defs = {
|
|
"V": "1",
|
|
},
|
|
pins = {"V": pwr},
|
|
)
|
|
"#,
|
|
);
|
|
|
|
env.add_file(
|
|
"top.star",
|
|
r#"
|
|
Sub = Module("my_sub.star")
|
|
|
|
Sub(
|
|
name = "sub",
|
|
pwr = Net("VCC"),
|
|
baud = 9600,
|
|
)
|
|
"#,
|
|
);
|
|
|
|
star_snapshot!(env, "top.star");
|
|
}
|
|
|
|
#[test]
|
|
fn snapshot_undefined_placeholder() {
|
|
let env = TestProject::new();
|
|
|
|
env.add_file(
|
|
"my_sub.star",
|
|
r#"
|
|
# Declare input placeholders
|
|
pwr = io("pwr", Net, optional = True)
|
|
|
|
Component(
|
|
name = "comp0",
|
|
footprint = "TEST:0402",
|
|
pin_defs = {"V": "1"},
|
|
pins = {"V": pwr},
|
|
)
|
|
"#,
|
|
);
|
|
|
|
env.add_file(
|
|
"top.star",
|
|
r#"
|
|
Sub = Module("my_sub.star")
|
|
|
|
Sub(
|
|
name = "sub",
|
|
# Missing `pwr`
|
|
)
|
|
"#,
|
|
);
|
|
|
|
star_snapshot!(env, "top.star");
|
|
}
|