Repository navigation
Conversation
Both were named text_ instead of test_, so neither has ever run: - text_faker_naruto.rb is outside the test/**/test*.rb glob (since cb72197). - TestFakerCompany#text_indian_gst_number isn't picked up by Test::Unit (since 205bc52). Renaming the GST test exposed two problems it would have caught: - its regex only allowed state codes 00-37, while indian_gst_number generates 02-38 and 98, as documented; - ~10% of generated numbers were 14 characters: `int(length: 4, ranges: [0..9999])` ignores length when ranges are given, so values below 1000 weren't zero-padded. Generate 4 digits instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
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.
Motivation / Background
This Pull Request has been created because two tests are named
text_instead oftest_, so neither has ever run:test/faker/japanese_media/text_faker_naruto.rbis outside thetest/**/**/test*.rbglob. It's been that way since cb72197 (2020). Renamed, its 4 tests pass.TestFakerCompany#text_indian_gst_numberisn't picked up by Test::Unit. It's been that way since 205bc52.Turning the GST test back on exposed two bugs it would have caught:
00–37, butindian_gst_numbergenerates02–38and98, as documented. The regex now matches what's documented.13AGZHR303L5ZS).g_.int(length: 4, ranges: [0..9999])ignoreslengthwhenrangesis given (PositionalGenerator::Int), so values below 1000 weren't zero-padded. It now usesg_.int(length: 4)(1000–9999). That drops the 0001–0999 range real PANs allow, in exchange for always being 15 characters. Happy to pad instead if you'd rather keep the full range.Additional information
5,000 generated GSTINs all match the updated regex and are all 15 characters.
This depends on #3326. With these tests running, the suite's fixed random sequence (the
Random.new(42)thattest_determinismleaves set) shifts and lands on a duplicate first name intest_nested_json_length. With #3326 merged in,rake testpasses (2185 tests), and rubocop is clean.Checklist
[Fix #issue-number]Found with trekr