tests: rb: Add type conversion test for ruby loader#822
Open
AshutoshSharma-pixel wants to merge 4 commits into
Open
tests: rb: Add type conversion test for ruby loader#822AshutoshSharma-pixel wants to merge 4 commits into
AshutoshSharma-pixel wants to merge 4 commits into
Conversation
Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>
Member
|
Running CI |
…e conversion matrix Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>
Member
|
Add tests please. |
…nd buffer round-trips Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>
Author
|
added assertions for Bool, Int, Long, Double, String, Array, Map and Buffer round-trips. also implemented Buffer (IO::Buffer), Array and Map serialization/deserialization in rb_loader. all pass locally. [ PASSED ] 1 test |
Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>
Author
|
fixed the ubuntu:jammy build failure ruby/io/buffer.h is only available in Ruby >= 3.0, so I've gated the IO::Buffer include and usage behind RUBY_API_VERSION_MAJOR >= 3. on older Ruby versions the buffer falls back to a plain binary string. also added ruby/version.h to the loader include header to ensure the macro is defined. still passes locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds metacall_ruby_conversion_test, modeled after metacall_node_conversion_test.
The test loads an identity function from memory using the rb loader and runs it
against all METACALL_* types, printing the conversion matrix.
Local test output on macOS with Ruby 3.2.2:
Boolean => Boolean
Fixnum => Fixnum
Bignum => Bignum
Float => Float
String => String
Array => Array
NilClass => NilClass
Notable difference from the Node loader: Ruby preserves numeric type granularity
(Fixnum, Bignum, Float remain distinct) whereas Node collapses all numeric types
to METACALL_DOUBLE.
Tested locally with:
cmake -DOPTION_BUILD_LOADERS=ON -DOPTION_BUILD_LOADERS_RB=ON -DOPTION_BUILD_TESTS=ON
cmake --build . --target metacall-ruby-conversion-test
ctest -R metacall-ruby-conversion-test --verbose
[ PASSED ] 1 test