Add test for UTF-8 Parsing
jwilm opened this issue · 6 comments
The utf8parse
package could use a test validating the implementation. My thought about how to do this is to find some complicated UTF-8 file and compare results of parsing it with this package's parser and the standard library's std::str::from_utf8()
.
Approach
Implement a utf8parse::Receiver
for something wrapping a String
. Read the UTF-8 test file into a buffer. for each byte in the buffer, advance()
the utf8parse::Parser
. After running all bytes through the parser, let the string be the actual
value. Now, call String::from_utf8()
on the test file buffer; let that be the expected
value. Assert that those values are equal.
Links
I love how you're adding easy issues for new contributors. Might be worth working on this project once I learn Rust. I need to create a very basic virtual terminal widget for a project anyway, and this project is the only recently updated project related to virtual terminals in Rust. Do you plan on making this a full blown virtual terminal like the inactive rust-terminal?
@AravSinghal this project is just intended to be a state machine for the ansi terminal protocol, nothing more. I have plans for higher level libraries as well which will use this project internally.
I would like to take this! Thanks for bringing it to my attention.
@lizbaillie all yours :)
@jwilm created a WIP PR - did not get very far this morning, but thought it might be helpful for you to see my progress so far, in case there was something I was doing obviously wrong from the get-go 😛