Skip to content

[stdlib] Add OptionSet tests #11683

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

Merged
merged 3 commits into from
Aug 30, 2017
Merged

[stdlib] Add OptionSet tests #11683

merged 3 commits into from
Aug 30, 2017

Conversation

lancep
Copy link
Contributor

@lancep lancep commented Aug 29, 2017

Test our public OptionSet API

This adds validation tests for the public API of OptionSet.

@lancep
Copy link
Contributor Author

lancep commented Aug 29, 2017

@swift-ci please smoke test

Copy link
Contributor

@moiseev moiseev left a comment

Choose a reason for hiding this comment

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

I don't remember whether we have the SetAlgebra conformance tests. But it would be nice to add a test for that too.

OptionSetTests.test("RawValue.SingleOption") {
let s = Days.friday

assert(s.rawValue == 32)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and everywhere why assert?

Copy link
Contributor

Choose a reason for hiding this comment

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

expectEqual or expectTrue.

let member1 = s.update(with: .monday)

assert(s.contains(.monday))
expectEqual(member1, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

expectNil

expectEqual(member1, nil)

let member2 = s.update(with: .monday)
expectEqual(member2, .monday)
Copy link
Contributor

Choose a reason for hiding this comment

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

expectOptionalEqual

@lancep
Copy link
Contributor Author

lancep commented Aug 29, 2017

I have a separate bug for the SetAlgebra tests

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

LGTM

@lancep
Copy link
Contributor Author

lancep commented Aug 30, 2017

@swift-ci please smoke test

@moiseev moiseev changed the title Add OptionSet tests [stdlib] Add OptionSet tests Aug 30, 2017
@moiseev moiseev merged commit 3a0dd61 into swiftlang:master Aug 30, 2017
@lancep lancep deleted the optionSetTests branch September 5, 2017 17:37
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.

4 participants