Skip to content

Commit a26f8d9

Browse files
committed
config: fix merge op on symlink_root
Signed-off-by: Paul Osborne <[email protected]>
1 parent b6904f1 commit a26f8d9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ impl GpioConfig {
197197
///
198198
/// If in conflict, the other GPIO config takes priority.
199199
pub fn update(&mut self, other: GpioConfig) {
200+
if let Some(symlink_root) = other.symlink_root {
201+
self.symlink_root = Some(symlink_root);
202+
}
203+
200204
for other_pin in other.pins {
201205
// determine the case we are dealing with
202206
let existing = match self.pins.iter_mut().find(|p| p.num == other_pin.num) {
@@ -254,6 +258,9 @@ export = true
254258
"#;
255259

256260
const PARTIALLY_OVERLAPS_BASIC_CFG: &'static str = r#"
261+
[config]
262+
symlink_root = "/foo/bar/baz"
263+
257264
# Add a new alias to pin 73
258265
[[pins]]
259266
num = 73
@@ -344,6 +351,8 @@ names = ["wildcard"]
344351
// perform the merge
345352
config.update(cfg2);
346353

354+
assert_eq!(config.get_symlink_root(), "/foo/bar/baz");
355+
347356
let reset_button = config.pins.get(0).unwrap();
348357
assert_eq!(reset_button.num, 73);
349358
assert_eq!(reset_button.names,

0 commit comments

Comments
 (0)