Skip to content

Fix TestFoundation Imports #1220

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 2 commits into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions TestFoundation/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ import Dispatch

#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
import Foundation
import Glibc
import XCTest
#else
import CoreFoundation
import SwiftFoundation
import Darwin
import SwiftXCTest
#endif

#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif


public let globalDispatchQueue = DispatchQueue.global()
public let dispatchQueueMake: (String) -> DispatchQueue = { DispatchQueue.init(label: $0) }
public let dispatchGroupMake: () -> DispatchGroup = DispatchGroup.init
Expand Down Expand Up @@ -97,10 +101,11 @@ class _TCPSocket {
// Listen on the loopback address so that OSX doesnt pop up a dialog
// asking to accept incoming connections if the firewall is enabled.
let addr = UInt32(INADDR_LOOPBACK).bigEndian
let netPort = UInt16(bigEndian: port ?? 0)
#if os(Linux)
return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: htons(port ?? 0), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: netPort, sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
#else
return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: CFSwapInt16HostToBig(port ?? 0), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: netPort, sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
#endif
}

Expand Down
1 change: 0 additions & 1 deletion TestFoundation/TestCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import XCTest
import SwiftFoundation
import SwiftXCTest
#endif
import CoreFoundation

class TestCalendar: XCTestCase {

Expand Down
1 change: 0 additions & 1 deletion TestFoundation/TestNSGeometry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
import Foundation
import XCTest
import CoreFoundation
#else
import SwiftFoundation
import SwiftXCTest
Expand Down
1 change: 0 additions & 1 deletion TestFoundation/TestNumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import SwiftFoundation
import SwiftXCTest
#endif
import CoreFoundation

class TestNumberFormatter: XCTestCase {

Expand Down
1 change: 0 additions & 1 deletion TestFoundation/TestProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import SwiftFoundation
import SwiftXCTest
#endif
import CoreFoundation

class TestProcess : XCTestCase {
static var allTests: [(String, (TestProcess) -> () throws -> Void)] {
Expand Down
1 change: 0 additions & 1 deletion TestFoundation/TestXMLDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import SwiftXCTest
#endif

import CoreFoundation

class TestXMLDocument : XCTestCase {

Expand Down
9 changes: 7 additions & 2 deletions TestFoundation/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
import Foundation
import XCTest
import Glibc
#else
import SwiftFoundation
import SwiftXCTest
import Darwin
#endif

#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif


internal func testBundle() -> Bundle {
return Bundle.main
}
Expand Down