Skip to content

Add class-level setUp and tearDown methods on XCTestCase #102

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 1 commit into from
Apr 29, 2016

Conversation

briancroom
Copy link
Contributor

This adds support for setUp and tearDown class methods on XCTestCase which Apple XCTest has, and we were still missing. These are called by a private XCTestSuite subclass which is configured explicitly with the test case class whose tests are in the suite.

@@ -21,6 +21,12 @@ class SetUpTearDownTestCase: XCTestCase {

var value = 0

// CHECK: In class setUp\(\)
Copy link
Contributor

Choose a reason for hiding this comment

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

With #94 merged you may now indent the // CHECK:, like so:

func myFunc() {
    // CHECK: foo
    print("foo")
    if (bar) {
        // CHECK: baz
        print("baz")
    }
}

I think indenting is more readable, so I'd encourage you to do that! (I had been meaning to start sending out pull requests to indent the checks in the tests, but forgot 😇 )

Copy link
Contributor Author

@briancroom briancroom Apr 29, 2016

Choose a reason for hiding this comment

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

Ooh right, thanks for the reminder! I'll just change the newly-added lines for now though to keep the diff clean.

@modocache
Copy link
Contributor

Excellent! 💯

@briancroom briancroom force-pushed the class-setUp-tearDown branch from fe31f89 to 69dc41b Compare April 29, 2016 18:11
@briancroom
Copy link
Contributor Author

Thanks for the feedback @modocache. I pushed some tweaks now.

Would someone mind kicking off CI? (I'll also note that this will be the first build since swiftlang/swift#2259 was merged.) Thanks!
@mike-ferris-apple @parkera @ddunbar

@mike-ferris
Copy link

@swift-ci please test

@briancroom
Copy link
Contributor Author

Success 😄

@briancroom briancroom merged commit e3b502b into swiftlang:master Apr 29, 2016
@briancroom briancroom deleted the class-setUp-tearDown branch April 29, 2016 22:41
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