Merge branch 'main' into dependabot/cargo/libc-0.2.119

This commit is contained in:
mathieupoirier 2022-02-22 16:43:48 -07:00 committed by GitHub
commit 007f01a43b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -163,9 +163,9 @@ impl TryFrom<I2cArgs> for I2cConfiguration {
return Err(Error::SocketCountInvalid(0));
}
let devices = AdapterConfig::try_from(args.device_list.as_str())?;
let devices = AdapterConfig::try_from(args.device_list.trim())?;
Ok(I2cConfiguration {
socket_path: args.socket_path,
socket_path: args.socket_path.trim().to_string(),
socket_count: args.socket_count,
devices,
})
@ -324,6 +324,12 @@ mod tests {
fn test_parse_successful() {
let socket_name = "vi2c.sock";
// Space before and after the device list and socket name
let cmd_args = I2cArgs::from_args(" ./vi2c.sock", " 1:4 ", 1);
let config = I2cConfiguration::try_from(cmd_args).unwrap();
Listener::new(config.socket_path, true).unwrap();
// Valid configuration
let cmd_args = I2cArgs::from_args(socket_name, "1:4,2:32:21,5:5:23", 5);
let config = I2cConfiguration::try_from(cmd_args).unwrap();

@ -1 +1 @@
Subproject commit d216a46879096a4f1e83af3a7b6c90c26e1a688d
Subproject commit ee6be8ca18bdfd9de294652472307c6776194f89