Add unit tests for BDVCountryNameAndCode methods - #7
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Add unit tests for BDVCountryNameAndCode methods#7devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add 53 unit tests covering all public methods, with special focus on getCountrySuffixForPrefix (unique codes, shared codes, string dial codes, no-match, nil input) - Add initWithPlistPath: initializer for testability - Add helper methods: prefixForCountryCode:, countryNameAtIndex:, allCountryNames, allPrefixDialingCodes - Guard UIImage usage with __has_include for cross-platform compilation - Move ivars to header for GNU runtime compatibility - Change getCountrySuffixForPrefix: param type from NSString* to id to correctly handle NSNumber dial codes from the plist - Add Makefile for building/running tests with GNUstep on Linux - Add .gitignore for build artifacts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Adds 53 unit tests covering all public methods, with primary focus on the new
getCountrySuffixForPrefix:method. Tests are built and run via GNUstep on Linux using a simplemake testcommand.Changes
Test file (
BDVCountryNameAndCodeTests.m):getCountrySuffixForPrefix:— 6 test groups: unique dial codes, shared dial codes (e.g. +44 → GB/GG/IM/JE), string dial codes (e.g. "+1 684"), no-match, nil input, multiple shared codes (+61, +1, +47)prefixForCountryCode:— known codes, case-insensitivity, non-existent codecountryNameAtIndex:— first/second entry, out-of-boundsallCountryNames/allPrefixDialingCodes— count validation, spot checksinitWithPlistPath:— invalid path, nil path edge casesSource changes (backwards-compatible):
initWithPlistPath:designated initializer for testabilityprefixForCountryCode:,countryNameAtIndex:,allCountryNames,allPrefixDialingCodesgetCountrySuffixForPrefix:parameter type fromNSString *toid(plist stores dial codes as both NSNumber and NSString)UIImageusage with__has_include(<UIKit/UIKit.h>)for cross-platform compilation@implementationblock to@interfacefor GNU runtime compatibilityloadPlistFromPath:to share init logic betweeninitandinitWithPlistPath:Build infrastructure:
Makefile—make testbuilds and runs the test suite.gitignore— excludes build artifactsReview & Testing Checklist for Human
initWithPlistPath:initializer doesn't break existinginitbehavior when used from NSBundle (Xcode/iOS)getCountrySuffixForPrefix:type change fromNSString *toidis compatible with existing callersmake testlocally to verify all 53 tests passNotes
All 53 tests pass on Ubuntu/GNUstep. The
UIImage-dependentcountryFlagForCurrentLocalemethod is excluded from testing on Linux (guarded by__has_include).Link to Devin session: https://app.devin.ai/sessions/eff22b773a6d4323ba77f2886839fde8
Requested by: @basdvries