Skip to content

Fix failing typecast in section validation tests#108

Merged
alinebee merged 1 commit intomasterfrom
fix-uniqueness-tests
Aug 23, 2018
Merged

Fix failing typecast in section validation tests#108
alinebee merged 1 commit intomasterfrom
fix-uniqueness-tests

Conversation

@alinebee
Copy link
Copy Markdown
Contributor

@alinebee alinebee commented Aug 21, 2018

This PR fixes a conditional cast from [String] to Set<String> that now (as of Swift 4.2 maybe?) always fails, which was causing a pair of tests to fail.

Copy link
Copy Markdown
Contributor

@sherryshao sherryshao left a comment

Choose a reason for hiding this comment

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

🙏 apologies for the delayed approval, thanks for fixing!

XCTAssertEqual($0.userInfo!["Duplicates"] as? Set<String>, Set(arrayLiteral: "section1"))

if let duplicates = $0.userInfo?["Duplicates"] as? [String] {
XCTAssertEqual(Set(duplicates), Set(["section1"]))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't this always going to make them the same? if duplicates is ["section1", "section1"] it will be collapsed to ["section1"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

duplicates is expected to contain each unique key that was duplicated: one entry per key, not one per section, but we don't care about the number. What we really care about is "does duplicates contain the duplicate key, with no false positives for other keys?"

@alinebee alinebee merged commit 9c5a19a into master Aug 23, 2018
@alinebee alinebee deleted the fix-uniqueness-tests branch August 23, 2018 19:30
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.

3 participants