Skip to content

Conversation

@aeroastro
Copy link
Contributor

@aeroastro aeroastro commented Aug 14, 2023

Summary

This patch fixes the issue that rake test does not actually test
C extension for CRuby.

The Bug

The test task is defined as follows:

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L109-L110

This invokes :test_pure and :test_ext consecutively.

:test_pure assigns ENV['JSON'] = 'pure' as follows:

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L97-L98

However, :test_ext for CRuby does not change ENV['JSON'].

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/Rakefile#L252

This lead to require 'json/pure' in test_helper.rb, which test only the pure version.

https://github.com/flori/json/blob/7ec73ad240d45018f119f5d1a2eaa479ad3f9038/tests/test_helper.rb#L2-L4

How to Fix It

I have added :set_env_ext to guarantee that :test_ext assigns ENV['JSON'] = 'ext'.
This is just like test_ext in JRuby version

@hsbt hsbt merged commit 66950ee into ruby:master Sep 13, 2023
@aeroastro aeroastro deleted the feature/fix-running-ext-test branch September 14, 2023 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants