Files
Lenny Khazan d6ff024281 Update symbol handling, support gitlab packages (#14)
* Add Symbol() primitive

* Add print output to snaps

* gitlab support

* Add gitlab support, handle unnamed pins

* Add @kicad-symbols alias

* cargo fmt

* fmt

* update snap
2025-07-05 00:10:45 -04:00

73 lines
1.9 KiB
Rust

#[macro_use]
mod common;
snapshot_eval!(component_properties, {
"C146731.kicad_sym" => include_str!("resources/C146731.kicad_sym"),
"test_props.zen" => r#"
# Import component factory from current directory.
load(".", MyComponent = "C146731")
# Instantiate with pin connections and a custom property.
MyComponent(
name = "U1",
pins = {
"ICLK": Net("ICLK"),
"Q1": Net("Q1"),
"Q2": Net("Q2"),
"Q3": Net("Q3"),
"Q4": Net("Q4"),
"GND": Net("GND"),
"VDD": Net("VDD"),
"OE": Net("OE"),
},
footprint = "SMD:0805",
properties = {"CustomProp": "Value123"},
)
"#
});
snapshot_eval!(interface_net_incompatible, {
"Module.zen" => r#"
SingleNet = interface(signal = Net)
signal_if = SingleNet(name="sig")
Component(
name = "test_comp",
footprint = "test_footprint",
pin_defs = {"in": "1", "out": "2"},
pins = {
"in": signal_if, # This should fail - interfaces not accepted for pins
"out": Net()
}
)
"#
});
snapshot_eval!(component_with_symbol, {
"test.zen" => r#"
# Create a symbol
i2c_symbol = Symbol(
name="I2C",
definition=[
("SCL", ["1"]),
("SDA", ["2"]),
("VDD", ["3"]),
("GND", ["4"])
]
)
# Create a component using the symbol
Component(
name = "I2C_Device",
footprint = "SOIC-8",
symbol = i2c_symbol, # Use Symbol instead of pin_defs
pins = {
"SCL": Net("SCL"),
"SDA": Net("SDA"),
"VDD": Net("VDD"),
"GND": Net("GND"),
}
)
"#
});