Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To help obtain 100% coverage from #126, I've added few tests. Also, few comments on some files that are still not 100% covered:
decodeText.js
still misses line 97 and 98. Though, I'm not sure they will ever be hit:this
keyword at line 96 is used, but the method is an arrow function which is called viabind(charset)
from line 42; though, I'm afraid that, being an arrow function, the scope of thethis
inside of it will not be the passed value ofcharset
if
statement at line 96 will pass: we ask if thetextDecoders
has the givencharset
, wheretextDecoders
includesutf-8
andutf8
. But, if thecharset
passed at line 42 is one of the two values, then another branch of theswitch
statement is taken.urlencoded.js
still misses line 118 and 164, but again, I'm not sure that they will ever be hit.if
statement at line 118,p
needs to be higher thanlen
, and the only way I figured out is the loopfor
at line 58, where inside at line 59 we haveif (!this._checkingBytes) { ++p }
if
,this._checkingBytes
must befalse
, which happens at line 112, which is inside anelse if (this._hitLimit)
this._hitlimit
equals totrue
, but.. If that happens, since thatif else
statement is before the lastelse
at line 117 which leads to line 118, the line 118 cannot be reached withp
being greater or equals tolen
Of course, I may be wrong for both files: I tried to go through all the code and understanding it, but maybe I'm missing some pieces.
Checklist
npm run test
andnpm run benchmark
and the Code of conduct