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.
This crate was first created back when nom had the concept of “Done” vs “Finished”, which might seem a little out of place now but I still find it useful when testing. Basically, macros that test for “Done” check that the parser completed successfully, while macros that test for “Finished” check that the parser completed successfully while also asserting that the input is empty.
Modules
prelude | Instead of importing the helper macros individually, this can be star-imported to get all of them |
Macros
assert_done | This macro checks to make sure that the IResult it is
passed is |
assert_done_and_eq | This checks that the |
assert_error | This asserts that the |
assert_error_and_eq | This asserts that the |
assert_finished | This does the same thing as |
assert_finished_and_eq | Same as |
assert_needed | This asserts that the |
assert_needs | This lets the user specify how much input the parser should need |