Skip to content

Commit

Permalink
add test parse domain name in RR
Browse files Browse the repository at this point in the history
  • Loading branch information
valesteban committed Nov 17, 2023
1 parent ee1500a commit b8cd454
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/resolver/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,6 @@ mod async_resolver_test {
println!("response_future {:?}",response_future);

assert_eq!(response_future.is_ok(), false);



}

#[tokio::test]
Expand Down Expand Up @@ -535,4 +532,23 @@ mod async_resolver_test {
assert!(false);
}
}

#[test]
fn parse_error_domain_name() {
let bytes: [u8; 50] = [
//test passes with this one
0b10100101, 0b10010101, 0b11111111, 0b11111111, 0, 1, 0b00000000, 1, 0, 0, 0, 0, 4, 116,
101, 115, 64, 3, 99, 111, 109, 0, 0, 16, 0, 1, 3, 100, 99, 99, 2, 99, 108, 0, 0, 16, 0,
1, 0, 0, 0b00010110, 0b00001010, 0, 6, 5, 104, 101, 108, 108, 111,
];
let response_result: Result<Vec<u8>, ClientError> = Ok(bytes.to_vec());
let response_dns_msg = parse_response(response_result);
let err_msg = "The name server was unable to interpret the query.".to_string();

if let Err(ResolverError::Parse(err)) = response_dns_msg {
assert_eq!(err, err_msg)
} else {
assert!(false);
}
}
}

0 comments on commit b8cd454

Please sign in to comment.