Update EnvironmentValueArrayDecoder to emit empty values when present #133
+44
−4
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
Closes #122
Modifications
omittingEmptySubsequencestofalseinString.split(separator:omittingEmptySubsequences:)when decoding a string that represents Bool, Int, or Double arrays separated by commas inEnvironmentValuesProvider.CLIArgumentParser.swift:125to usesplitinstead ofcomponents(separatedBy:), ensuring homogeneous usage of Swift’s splitting APIs.Result
A string representing an array of values separated by
","will now emit empty values when two separators appear together while parsingEnvironmentValuesProviderdictionaries.This results in treating an empty value as an empty string and, consequently, throwing an error when parsed by individual value decoders for Int, Double, and Bool.
The additional update enforces homogeneous API usage and favors Swift’s native
split(separator:)method.Test Plan
Add tests covering empty values in Int, Double, and Bool arrays.