diff options
| author | Benoit Daloze <eregontp@gmail.com> | 2024-01-24 21:12:31 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-01-26 21:34:34 +0000 |
| commit | de135bc247408712a0f630010778af0b405bae1f (patch) | |
| tree | 185a573d5dcc1a16df3fd60e7978480dbe7d5dcc /test/prism | |
| parent | bcafd28a3e2ec6c35d80c55a5d11c2f8aab6fc8b (diff) | |
[ruby/prism] Add level to warnings and errors to categorize them
* Fixes https://github.com/ruby/prism/issues/2082
https://github.com/ruby/prism/commit/7a74576357
Diffstat (limited to 'test/prism')
| -rw-r--r-- | test/prism/errors_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index 304d55274e..b7215c755d 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -1871,6 +1871,16 @@ module Prism ] end + def test_warnings_verbosity + warning = Prism.parse("def foo; END { }; end").warnings[0] + assert_equal "END in method; use at_exit", warning.message + assert_equal :warning_verbose_not_nil, warning.level + + warning = Prism.parse("foo /regexp/").warnings[0] + assert_equal "ambiguous `/`; wrap regexp in parentheses or add a space after `/` operator", warning.message + assert_equal :warning_verbose_true, warning.level + end + def test_statement_operators source = <<~RUBY alias x y + 1 |
