Upgrade to Pro — share decks privately, control downloads, hide ads and more …

"XCTSkip your tests" の
要約 / xctskip_your_tests_summary

uhooi
July 09, 2020

"XCTSkip your tests" の
要約 / xctskip_your_tests_summary

集まれSwift好き!Swift愛好会スピンオフ WWDC20セッション要約会 @オンライン
https://love-swift.connpass.com/event/181458/

## 参考リンク

- XCTSkip your tests - WWDC 2020 - Videos - Apple Developer
https://developer.apple.com/videos/play/wwdc2020/10164/

- XCTSkip | Apple Developer Documentation
https://developer.apple.com/documentation/xctest/xctskip

- XCTSkipIf(_:_:file:line:) | Apple Developer Documentation
https://developer.apple.com/documentation/xctest/3521325-xctskipif

- XCTSkipUnless(_:_:file:line:) | Apple Developer Documentation
https://developer.apple.com/documentation/xctest/3521326-xctskipunless

- swift-corelibs-xctest/XCTSkip.swift at master · apple/swift-corelibs-xctest
https://github.com/apple/swift-corelibs-xctest/blob/master/Sources/XCTest/Public/XCTSkip.swift

uhooi

July 09, 2020
Tweet

More Decks by uhooi

Other Decks in Programming

Transcript

  1. #FGPSFʢ9DPEFະຬʣ func test_iPadOnly_before() { let isIPad = (UIDevice.current.userInterfaceIdiom == .pad)

    guard isIPad else { return } // TODO: iPadઐ༻ͷςετΛ࣮ߦ͢Δ } ৗʹ੒ޭѻ͍ʹ͢Δ
  2. "GUFSʢ9DPEFҎ߱ʣ func test_iPadOnly_after() throws { let isIPad = (UIDevice.current.userInterfaceIdiom ==

    .pad) guard isIPad else { throw XCTSkip("This tests are for iPad only") } // TODO: iPadઐ༻ͷςετΛ࣮ߦ͢Δ }
  3. εΩοϓ͢Δํ๏͸छྨ͋Δ func test_iPadOnly_after() throws { let isIPad = (UIDevice.current.userInterfaceIdiom ==

    .pad) // ᶃ guard isIPad else { throw XCTSkip("This tests are for iPad only") } // ᶄ try XCTSkipIf(!isIPad, "This tests are for iPad only") // ᶅ try XCTSkipUnless(isIPad, "This tests are for iPad only") } ᶄͱᶅΛ࢖͍෼͚Δͷ͕ Αͦ͞͏