diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-09-15 10:40:18 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-09-15 22:38:58 +0000 |
commit | 18780c22f657be2a0251fbf174fb46fd8523fae7 (patch) | |
tree | 2c695c747141e517d0ef53bf8c3286ddbec5cd20 /test/yarp | |
parent | b848700ccfffc0d4c424daa10ca29e19106e8e3f (diff) | |
download | ruby-18780c22f657be2a0251fbf174fb46fd8523fae7.tar.gz |
[ruby/yarp] Properly handle invalid underscores in number literals
https://github.com/ruby/yarp/commit/35da3d1a4c
Diffstat (limited to 'test/yarp')
-rw-r--r-- | test/yarp/errors_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb index 3539c54cf4..54cbda14d1 100644 --- a/test/yarp/errors_test.rb +++ b/test/yarp/errors_test.rb @@ -1237,6 +1237,24 @@ module YARP assert_errors expression(source), source, errors, compare_ripper: false end + def test_invalid_number_underscores + error_messages = ["Invalid underscore placement in number"] + + assert_error_messages "1__1", error_messages + assert_error_messages "0b1__1", error_messages + assert_error_messages "0o1__1", error_messages + assert_error_messages "01__1", error_messages + assert_error_messages "0d1__1", error_messages + assert_error_messages "0x1__1", error_messages + + assert_error_messages "1_1_", error_messages + assert_error_messages "0b1_1_", error_messages + assert_error_messages "0o1_1_", error_messages + assert_error_messages "01_1_", error_messages + assert_error_messages "0d1_1_", error_messages + assert_error_messages "0x1_1_", error_messages + end + private def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby") |