-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fixes SR-822, support tests directly under Tests directory #162
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b94ec32
Fixes SR-822, support tests directly under Tests directory
bhargavg 336ad97
Add linux test cases properly, removed partition in Array Extensions
bhargavg 14f8289
Add LinuxMain.swift files to fixtures
bhargavg 9fac493
Convert if-else to guard
bhargavg 801b3b9
Fix building issues
bhargavg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
3 changes: 3 additions & 0 deletions
3
Fixtures/InvalidLayouts/DirectTestsWithModules1/Sources/ModuleA/Foo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Foo { | ||
var bar: Int = 0 | ||
} |
16 changes: 16 additions & 0 deletions
16
Fixtures/InvalidLayouts/DirectTestsWithModules1/Tests/FooTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import XCTest | ||
|
||
@testable import ModuleA | ||
|
||
class FooTests: XCTestCase { | ||
func testSuccess() { | ||
} | ||
} | ||
|
||
extension FooTests { | ||
static var allTests: [(String, FooTests -> () throws -> Void)] { | ||
return [ | ||
("testSuccess", testSuccess), | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Fixtures/InvalidLayouts/DirectTestsWithModules1/Tests/LinuxMain.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import XCTest | ||
|
||
@testable import ModuleAtest | ||
|
||
XCTMain([ | ||
testCase(BarTests.allTests) | ||
]) |
16 changes: 16 additions & 0 deletions
16
Fixtures/InvalidLayouts/DirectTestsWithModules1/Tests/ModuleA/ModuleATests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import XCTest | ||
|
||
@testable import ModuleA | ||
|
||
class BarTests: XCTestCase { | ||
func testSuccess() { | ||
} | ||
} | ||
|
||
extension BarTests { | ||
static var allTests: [(String, BarTests -> () throws -> Void)] { | ||
return [ | ||
("testSuccess", testSuccess), | ||
] | ||
} | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
Fixtures/InvalidLayouts/DirectTestsWithModules2/Sources/Foo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Foo { | ||
var bar: Int = 0 | ||
} |
16 changes: 16 additions & 0 deletions
16
Fixtures/InvalidLayouts/DirectTestsWithModules2/Tests/DirectTestsWithModules2/BarTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import XCTest | ||
|
||
@testable import DirectTestsWithModules2 | ||
|
||
class BarTests: XCTestCase { | ||
func testSuccess() { | ||
} | ||
} | ||
|
||
extension BarTests { | ||
static var allTests: [(String, BarTests -> () throws -> Void)] { | ||
return [ | ||
("testSuccess", testSuccess), | ||
] | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Fixtures/InvalidLayouts/DirectTestsWithModules2/Tests/FooTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import XCTest | ||
|
||
class FooTests: XCTestCase { | ||
func testSuccess() { | ||
} | ||
} | ||
|
||
extension FooTests { | ||
static var allTests: [(String, FooTests -> () throws -> Void)] { | ||
return [ | ||
("testSuccess", testSuccess), | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Fixtures/InvalidLayouts/DirectTestsWithModules2/Tests/LinuxMain.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import XCTest | ||
|
||
@testable import DirectTestsWithModules2test | ||
|
||
XCTMain([ | ||
testCase(BarTests.allTests) | ||
]) |
Empty file.
3 changes: 3 additions & 0 deletions
3
Fixtures/ValidLayouts/SingleModule/DirectTests/Sources/Foo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Foo { | ||
var bar: Int = 0 | ||
} |
14 changes: 14 additions & 0 deletions
14
Fixtures/ValidLayouts/SingleModule/DirectTests/Tests/FooTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import XCTest | ||
|
||
class FooTests: XCTestCase { | ||
func testSuccess() { | ||
} | ||
} | ||
|
||
extension FooTests { | ||
static var allTests: [(String, FooTests -> () throws -> Void)] { | ||
return [ | ||
("testSuccess", testSuccess), | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Fixtures/ValidLayouts/SingleModule/DirectTests/Tests/LinuxMain.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import XCTest | ||
|
||
@testable import DirectTeststest | ||
|
||
XCTMain([ | ||
testCase(FooTests.allTests) | ||
]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright 2015 - 2016 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
*/ | ||
|
||
extension SequenceType { | ||
@warn_unused_result | ||
public func partition(@noescape include: (Generator.Element) -> Bool) -> ([Generator.Element], [Generator.Element]) { | ||
var left = Array<Generator.Element>() | ||
var right = Array<Generator.Element>() | ||
|
||
for element in self { | ||
if include(element) { | ||
left.append(element) | ||
} else { | ||
right.append(element) | ||
} | ||
} | ||
|
||
return (left, right) | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,13 @@ class ValidLayoutsTestCase: XCTestCase { | |
} | ||
} | ||
|
||
func testEmptyPackageWithDirectTests() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
fixture(name: "ValidLayouts/SingleModule/DirectTests", file: #file, line: #line) { prefix in | ||
XCTAssertBuilds(prefix) | ||
XCTAssertFileExists(prefix, ".build", "debug", "DirectTests.swiftmodule") | ||
} | ||
} | ||
|
||
func testMultipleModulesLibraries() { | ||
runLayoutFixture(name: "MultipleModules/Libraries") { prefix in | ||
XCTAssertBuilds(prefix) | ||
|
@@ -152,6 +159,8 @@ extension InvalidLayoutsTestCase { | |
("testInvalidLayout3", testInvalidLayout3), | ||
("testInvalidLayout4", testInvalidLayout4), | ||
("testInvalidLayout5", testInvalidLayout5), | ||
("testDirectTestsWithModules1", testDirectTestsWithModules1), | ||
("testDirectTestsWithModules2", testDirectTestsWithModules2), | ||
] | ||
} | ||
} | ||
|
@@ -189,6 +198,7 @@ extension ValidLayoutsTestCase { | |
("testSingleModuleExecutable", testSingleModuleExecutable), | ||
("testSingleModuleCustomizedName", testSingleModuleCustomizedName), | ||
("testSingleModuleSubfolderWithSwiftSuffix", testSingleModuleSubfolderWithSwiftSuffix), | ||
("testEmptyPackageWithDirectTests", testEmptyPackageWithDirectTests), | ||
("testMultipleModulesLibraries", testMultipleModulesLibraries), | ||
("testMultipleModulesExecutables", testMultipleModulesExecutables), | ||
("testPackageIdentifiers", testPackageIdentifiers), | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Linux support. It should be like