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

Tests for Rfc2616 parser #1593

Merged
merged 2 commits into from Dec 16, 2017
Merged

Tests for Rfc2616 parser #1593

merged 2 commits into from Dec 16, 2017

Conversation

@cquiroz
Copy link
Member

@cquiroz cquiroz commented Dec 14, 2017

This PR starts from a change I want to do removing Registry from MediaRange. To do so I needed to generate MediaRange instances for scalacheck, which led me to create generators for various parts of the http spec previously untested.

This PR contains a test and the generators but there is one that is contentious and I'd like to get your comments

@cquiroz cquiroz added the RFC label Dec 14, 2017
testing/src/main/scala/org/http4s/testing/ArbitraryInstances.scala Outdated

val genText: Gen[String] = oneOf(nonEmptyListOf(oneOf(allowedText)).map(_.mkString), genLws)

val allowedQDText: List[Char] = allowedText.filterNot(c => c == '"' || c == '\\')

This comment has been minimized.

@cquiroz

cquiroz Dec 14, 2017
Author Member

According to spec the backslash character \ is allowed but it seems the parser cannot handle one particular case where the Generated QDText ends on \" like e.g.

"_¡1S^¼m¬Á\"
"ìÙ\"

This is certainly a border case and I couldn't figure how to make the parboiled parser handle it properly so I tweaked the generator. WDYT?

This comment has been minimized.

@rossabaker

rossabaker Dec 15, 2017
Member

Certainly seems like we should be able to fix the parser. I don't want it to stand in the way of progress, but I'd like to leave a note so we try to fix it.

@cquiroz cquiroz force-pushed the cquiroz:rfc2616_parser branch to 78c0887 Dec 15, 2017
@cquiroz
Copy link
Member Author

@cquiroz cquiroz commented Dec 15, 2017

I added a comment and a small fix for scala 2.11. It's probably a good idea to review the generators anyway

Copy link
Member

@rossabaker rossabaker left a comment

I want to get in here and rename the implicits according to standard, but this looks like it moves the ball forward.

@cquiroz
Copy link
Member Author

@cquiroz cquiroz commented Dec 15, 2017

Which standard? I could rename them

@rossabaker
Copy link
Member

@rossabaker rossabaker commented Dec 15, 2017

This is how cats names them. I've been using http4s instead of catsPackageName as a unique-enough prefix.

@cquiroz
Copy link
Member Author

@cquiroz cquiroz commented Dec 15, 2017

I see, I will switch the convention. Looking at the arbitraries you can see there have been many hands involved

@cquiroz
Copy link
Member Author

@cquiroz cquiroz commented Dec 15, 2017

Maybe it's better to do another PR with all arbitraries names fixed in on go. Shall I merge this one to get my another change as a PR?

@rossabaker rossabaker merged commit a3a74ee into http4s:master Dec 16, 2017
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rossabaker
Copy link
Member

@rossabaker rossabaker commented Dec 16, 2017

Yes. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.