diff --git a/dns/src/strings.rs b/dns/src/strings.rs index 46489e2..d38930d 100644 --- a/dns/src/strings.rs +++ b/dns/src/strings.rs @@ -238,6 +238,18 @@ mod test { Ok((Labels::encode("one.").unwrap(), 5))); } + #[test] + fn one_label_underscore() { + let buf: &[u8] = &[ + 0x03, // label of length 3 + b'_', b'n', b'e', // label + 0x00, // end reading + ]; + + assert_eq!(Cursor::new(buf).read_labels(), + Ok((Labels::encode("_ne.").unwrap(), 5))); + } + #[test] fn two_labels() { let buf: &[u8] = &[