Crate nom_test_helpers [] [src]

Macros for testing nom parsers

Often when I'm testing nom parsers, I end up defining a lot of little macros like this, so I thought I would bundle them all up into a crate so I didn't have to define them over and over

Macros

assert_done

This macro checks to make sure that the IResult it is passed is Done

assert_done_and_eq

This checks that the IResult is Done, and lets you check that the value returned as the O type of the IResult is equal to the second parameter

assert_empty

Internal only, really, and not even necessary :P

assert_error

This asserts that the IResult is an Error

assert_error_and_eq

This asserts that the IResult is an Error and that the error is what is expected

assert_finished

This does the same thing as assert_done!, except that this also asserts that the input slice is empty

assert_finished_and_eq

Same as assert_done_and_eq!, but asserts that the input slice is empty

assert_needed

This asserts that the IResult is an Incomplete

assert_needs

This lets the user specify how much input the parser should need