diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-01-11 22:46:06 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2026-01-11 22:53:12 +0900 |
| commit | 8baaece6d9a64e8cc51d8d0c9839546e3d039eee (patch) | |
| tree | a4e16e1c73b47f247ce308afa825f47172aa74de /test/ruby | |
| parent | a071078e907af99db737799410d713d5ec953eb7 (diff) | |
[ruby/prism] [Bug #21831] Fix denominator of rational float literal
Denominators can contain underscores in fraction part as well as other
numeric literals.
[Bug #21831]: https://bugs.ruby-lang.org/issues/21831
https://github.com/ruby/prism/commit/e247cb58c7
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_literal.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index dbff3c4734..cff888d4b3 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -682,6 +682,11 @@ class TestRubyLiteral < Test::Unit::TestCase $VERBOSE = verbose_bak end + def test_rational_float + assert_equal(12, 0.12r * 100) + assert_equal(12, 0.1_2r * 100) + end + def test_symbol_list assert_equal([:foo, :bar], %i[foo bar]) assert_equal([:"\"foo"], %i["foo]) |
