diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2025-12-16 09:10:45 -0800 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2025-12-18 14:42:47 -0800 |
| commit | d0b72429a93e54f1f956b4aedfc25c57dc7001aa (patch) | |
| tree | 1e4303fd43d1b99972922bfdbb61fee6836b7bc5 /spec/ruby/core/string/unpack/shared/basic.rb | |
| parent | 73e930f9f911cf71ecb416c3112a7818bae41cd6 (diff) | |
Add support for signed and unsigned LEB128 to pack/unpack.
This commit adds a new pack format command `R` and `r` for unsigned and
signed LEB128 encoding. The "r" mnemonic is because this is a
"vaRiable" length encoding scheme.
LEB128 is used in various formats including DWARF, WebAssembly, MQTT,
and Protobuf.
[Feature #21785]
Diffstat (limited to 'spec/ruby/core/string/unpack/shared/basic.rb')
| -rw-r--r-- | spec/ruby/core/string/unpack/shared/basic.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/ruby/core/string/unpack/shared/basic.rb b/spec/ruby/core/string/unpack/shared/basic.rb index b37a447683..0ac2a951ed 100644 --- a/spec/ruby/core/string/unpack/shared/basic.rb +++ b/spec/ruby/core/string/unpack/shared/basic.rb @@ -12,7 +12,7 @@ describe :string_unpack_basic, shared: true do ruby_version_is "3.3" do # https://bugs.ruby-lang.org/issues/19150 it 'raise ArgumentError when a directive is unknown' do - -> { "abcdefgh".unpack("a R" + unpack_format) }.should raise_error(ArgumentError, /unknown unpack directive 'R'/) + -> { "abcdefgh".unpack("a K" + unpack_format) }.should raise_error(ArgumentError, /unknown unpack directive 'K'/) -> { "abcdefgh".unpack("a 0" + unpack_format) }.should raise_error(ArgumentError, /unknown unpack directive '0'/) -> { "abcdefgh".unpack("a :" + unpack_format) }.should raise_error(ArgumentError, /unknown unpack directive ':'/) end |
