ruby/test/prism/format_errors_test.rb
Alan Wu 770b5499a5 [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" '
```

8c0f84db4f
2024-02-01 22:04:46 +00:00

24 lines
656 B
Ruby

# frozen_string_literal: true
require_relative "test_helper"
return if Prism::BACKEND == :FFI
module Prism
class FormatErrorsTest < TestCase
def test_format_errors
assert_equal <<~ERROR, Debug.format_errors("<>", false)
> 1 | <>
| ^ 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