File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -98,22 +98,9 @@ pub fn literal(input: &[u8]) -> IResult<&[u8], &[u8]> {
9898
9999 let ( remaining, data) = take ( count) ( remaining) ?;
100100
101- if !data. iter ( ) . all ( |byte| is_char8 ( * byte) ) {
102- // FIXME: what ErrorKind should this have?
103- return Err ( nom:: Err :: Error ( nom:: error:: Error :: new (
104- remaining,
105- nom:: error:: ErrorKind :: Verify ,
106- ) ) ) ;
107- }
108-
109101 Ok ( ( remaining, data) )
110102}
111103
112- /// CHAR8 = %x01-ff ; any OCTET except NUL, %x00
113- pub fn is_char8 ( i : u8 ) -> bool {
114- i != 0
115- }
116-
117104// ----- astring ----- atom (roughly) or string
118105
119106// astring = 1*ASTRING-CHAR / string
@@ -285,6 +272,16 @@ mod tests {
285272 }
286273 }
287274
275+ #[ test]
276+ fn test_string_literal_containing_null ( ) {
277+ match string ( b"{5}\r \n X\0 Y\0 Z" ) {
278+ Ok ( ( _, value) ) => {
279+ assert_eq ! ( value, b"X\0 Y\0 Z" ) ;
280+ }
281+ rsp => panic ! ( "unexpected response {rsp:?}" ) ,
282+ }
283+ }
284+
288285 #[ test]
289286 fn test_astring ( ) {
290287 match astring ( b"text " ) {
You can’t perform that action at this time.
0 commit comments