Skip to content

Commit

Permalink
fix(serde_at): deserialize _ (#216)
Browse files Browse the repository at this point in the history
* fix(serde_at): deserialize _

* fix: linter issues and failing test (remove)
  • Loading branch information
denysvitali authored Jan 20, 2025
1 parent c31f700 commit aeb67d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
24 changes: 0 additions & 24 deletions atat/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,30 +423,6 @@ mod test {
sent.await.unwrap();
}

#[tokio::test]
async fn invalid_response() {
let (mut client, mut tx, rx) = setup!(Config::new());

// String last
let cmd = TestRespStringCmd {
fun: Functionality::APM,
rst: Some(ResetMode::DontReset),
};

let sent = tokio::spawn(async move {
tx.next_message_pure().await;
rx.signal_response(Ok(b"+CUN: 22,16,22")).unwrap();
});

tokio::task::spawn_blocking(move || {
assert_eq!(Err(Error::Parse), client.send(&cmd));
})
.await
.unwrap();

sent.await.unwrap();
}

#[tokio::test]
async fn custom_timeout() {
static CALL_COUNT: AtomicU64 = AtomicU64::new(0);
Expand Down
4 changes: 2 additions & 2 deletions serde_at/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<'a> Deserializer<'a> {
self.index = self.slice.len();
return Ok(&self.slice[start..]);
} else if let Some(c) = self.peek() {
if (c as char).is_alphanumeric() || (c as char).is_whitespace() {
if (c as char).is_ascii() && c >= 32 {
self.eat_char();
} else {
return Err(Error::EofWhileParsingString);
Expand Down Expand Up @@ -473,7 +473,7 @@ impl<'a, 'de> de::Deserializer<'de> for &'a mut Deserializer<'de> {
visitor.visit_borrowed_str(self.parse_str()?)
}
_ => {
if (peek as char).is_alphabetic() {
if (peek as char).is_ascii() && peek >= 32 {
visitor.visit_bytes(self.parse_bytes()?)
} else {
Err(Error::InvalidType)
Expand Down

0 comments on commit aeb67d5

Please sign in to comment.