Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test byte conversion #1771

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
error::{make_error, ErrorKind, ParseError},
sequence::pair,
AsBytes, AsChar, Compare, Either, Emit, Err, Input, IsStreaming, Mode, Needed, Offset, OutputM,
Parser,
OutputMode, Parser,
};

pub mod complete;
Expand Down Expand Up @@ -1397,8 +1397,23 @@
&mut self,
input: I,
) -> crate::PResult<OM, I, Self::Output, Self::Error> {
let (i, s) =
recognize_float_or_exceptions().process::<OutputM<Emit, OM::Error, OM::Incomplete>>(input)?;
let inp = input.clone();
let (_, s) = recognize_float_or_exceptions()
.process::<OutputM<Emit, OM::Error, OM::Incomplete>>(inp.as_bytes())

Check warning on line 1402 in src/number/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/number/mod.rs#L1402

Added line #L1402 was not covered by tests
.map_err(
|e: crate::Err<(), <<OM as OutputMode>::Error as Mode>::Output<()>>| match e {
Err::Incomplete(i) => Err::Incomplete(i),
Err::Error(_) => Err::Error(OM::Error::bind(|| {
E::from_error_kind(input.clone(), crate::error::ErrorKind::Float)

Check warning on line 1407 in src/number/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/number/mod.rs#L1404-L1407

Added lines #L1404 - L1407 were not covered by tests
})),
Err::Failure(_) => Err::Failure(E::from_error_kind(
input.clone(),
crate::error::ErrorKind::Float,

Check warning on line 1411 in src/number/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/number/mod.rs#L1409-L1411

Added lines #L1409 - L1411 were not covered by tests
)),
},
)?;
let recognized_length = s.len();
let (i, s) = input.take_split(recognized_length);

match s.parse_to() {
Some(f) => Ok((i, OM::Output::bind(|| f))),
Expand Down
Loading