[ruby/prism] Amend assert in pm_utf_8_codepoint(), n=0 is fine
This assert used to trip in the included test: ``` ./miniruby --parser=prism -e ' "%W"\u" ' ``` https://github.com/ruby/prism/commit/8c0f84db4f
This commit is contained in:
parent
4fbdbde088
commit
770b5499a5
@ -2252,7 +2252,7 @@ static const uint8_t pm_utf_8_dfa[] = {
|
||||
*/
|
||||
static pm_unicode_codepoint_t
|
||||
pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
|
||||
assert(n >= 1);
|
||||
assert(n >= 0);
|
||||
size_t maximum = (size_t) n;
|
||||
|
||||
uint32_t codepoint;
|
||||
|
@ -12,6 +12,13 @@ module Prism
|
||||
| ^ unexpected '<', ignoring it
|
||||
| ^ unexpected '>', ignoring it
|
||||
ERROR
|
||||
|
||||
assert_equal <<~'ERROR', Debug.format_errors('"%W"\u"', false)
|
||||
> 1 | "%W"\u"
|
||||
| ^ expected a newline or semicolon after the statement
|
||||
| ^ invalid token
|
||||
| ^ expected a closing delimiter for the string literal
|
||||
ERROR
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user