Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test for HPACKHeader.removeAll(keepingCapacity:) on Android #395

Merged
merged 1 commit into from
May 19, 2023

Conversation

finagolfin
Copy link
Contributor

Motivation:

Get this test passing on Android

Modifications:

Change the capacity to whatever it originally was, rather than a hard-coded value.

Result:

Resolves #394 and the test now passes

I could not reproduce on Android when assigning to a String array like this, implying this overcapacity is specific to this HPACK header array:

var headerArray : [String] = []

func assign(_ headers: [(String, String)] = []) {
   print(headers.count)
   print(headers.capacity)
   headerArray = headers.map { "headerKey : \($0.0), headerValue: \($0.1)" }
   print(headerArray.count)
   print(headerArray.capacity)
}
        let original = [
            ("foo", "bar"),
            ("bar", "foo"),
            ("foo", "baz"),
            ("foo", "bar,baz"),
            ("foo", " bar ,baz ,,"),
            ("bar", "foo")
        ]
assign(original)

Motivation:

Get this test passing on Android

Modifications:

Change the capacity to whatever it originally was, rather than a hard-coded value.

Result:

Resolves apple#394 and the test now passes
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it, thanks for the fix!

@Lukasa
Copy link
Contributor

Lukasa commented May 19, 2023

@swift-server-bot test this please

@Lukasa Lukasa merged commit f509541 into apple:main May 19, 2023
@finagolfin finagolfin deleted the droid branch May 19, 2023 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The new HPACK header test for RemoveAll() fails on Android
2 participants