Skip to content
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ permissions:
jobs:
call-workflow:
uses: skiptools/actions/.github/workflows/skip-framework.yml@v1
with:
runs-on: "['macos-13', 'ubuntu-24.04']"

2 changes: 1 addition & 1 deletion Tests/SkipFoundationTests/CoreLibs/TestDecimal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
#if !SKIP && canImport(Darwin) // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
#if !SKIP && canImport(Darwin) // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation
import XCTest

#if !SKIP
#if canImport(Darwin)
// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:

//===----------------------------------------------------------------------===//
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Formats/TestXMLDocument.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationXML)
import FoundationXML
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Formats/TestXMLParser.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationXML)
import FoundationXML
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import Foundation
import XCTest

#if SKIP || canImport(Darwin)

fileprivate typealias CaseRelativeFormat = (numericFull: String, namedShort: String, namedAbbreviated: String, dateComponents: DateComponents, timeInterval: TimeInterval)

/// Kotlin formats time intervals approaching/at 0 as "x ago"
Expand Down Expand Up @@ -297,3 +299,5 @@ class TestRelativeDateTimeFormatter: XCTestCase {
return (timeInterval, components, formattedString)
}
}

#endif
5 changes: 1 addition & 4 deletions Tests/SkipFoundationTests/Foundation/BundleTests.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
import OSLog
import XCTest

@available(macOS 13, iOS 16, watchOS 10, tvOS 16, *)
final class BundleTests: XCTestCase {
let logger: Logger = Logger(subsystem: "test", category: "BundleTests")

func testBundle() throws {
// Swift will be: Contents/Resources/ -- file:///~/Library/Developer/Xcode/DerivedData/DemoApp-ABCDEF/Build/Products/Debug/SkipFoundationTests.xctest/Contents/Resources/Skip_SkipFoundationTests.bundle/
// Kotlin will be: file:///~/Library/Developer/Xcode/DerivedData/DemoApp-ABCDEF/Build/Products/Debug/SkipFoundationTests.xctest/Contents/Resources/skip-foundation_SkipFoundationTests.bundle/Contents/Resources/textasset.txt

let resourceURL: URL = try XCTUnwrap(Bundle.module.url(forResource: "textasset", withExtension: "txt", subdirectory: nil, localization: nil))
logger.info("resourceURL: \(resourceURL.absoluteString)")
//logger.info("resourceURL: \(resourceURL.absoluteString)")
let str = try String(contentsOf: resourceURL)
XCTAssertEqual("Some text\n", str)
}
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Foundation/DateTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(CoreFoundation)
import CoreFoundation // for CFAbsoluteTimeGetCurrent()
#endif
import XCTest

@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
Expand Down
2 changes: 2 additions & 0 deletions Tests/SkipFoundationTests/Foundation/DigestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extension Data {
}
#endif

#if SKIP || canImport(CryptoKit) // i.e., not Linux
@available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)
final class DigestTests: XCTestCase {
func testSHA256() {
Expand Down Expand Up @@ -93,4 +94,5 @@ final class DigestTests: XCTestCase {
XCTAssertEqual("TrfwQeSZQ8gTfY7U+NQY+CDxexfk6hHVDJ2pevtMM2OXmxY9X/60uWhsXnMym1+vzg7XGgO729yGQgsPdAY19A==", Data(HMACSHA512.authenticationCode(for: Data("Your message to sign".utf8), using: SymmetricKey(data: Data("your-secret-key".utf8)))).base64EncodedString())
}
}
#endif

3 changes: 0 additions & 3 deletions Tests/SkipFoundationTests/Foundation/JSONTests.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import OSLog
import XCTest
import Foundation

@available(macOS 11, iOS 14, watchOS 7, tvOS 14, *)
class TestJSON : XCTestCase {
fileprivate let logger: Logger = Logger(subsystem: "test", category: "TestJSON")

struct StringField : Equatable, Codable {
var stringField: String
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/SkipFoundationTests/Foundation/LocaleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import Foundation
import XCTest

#if SKIP || canImport(Darwin)

@available(macOS 13, iOS 16, watchOS 10, tvOS 16, *)
final class LocaleTests: XCTestCase {
func testLanguageCodes() throws {
Expand Down Expand Up @@ -1051,3 +1053,5 @@ let xcstringsSample = """
}

"""
#endif

2 changes: 2 additions & 0 deletions Tests/SkipFoundationTests/Foundation/LoggerTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
#if SKIP || canImport(OSLog)
import OSLog
import XCTest

Expand All @@ -24,3 +25,4 @@ final class LoggerTests: XCTestCase {
logger.error("logger error test")
}
}
#endif
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestCachedURLResponse.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestDataURLProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestHTTPCookie.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestHTTPCookieStorage.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestHTTPURLResponse.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestHost.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestSocketPort.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURL.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// TODO: remove '// API marked unavailable for Skip:' portions as we make more API available
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLCache.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLComponents.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLCredential.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if !SKIP // disabled for to reduce test count and avoid io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLRequest.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
3 changes: 3 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLResponse.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
7 changes: 7 additions & 0 deletions Tests/SkipFoundationTests/Network/TestURLSession.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import XCTest

#if SKIP || canImport(Darwin) // many of these tests don't build for Linux
class TestURLSession: XCTestCase {
func testDefaultURLSessionConfiguration() {
let config = URLSessionConfiguration.default
XCTAssertEqual(nil, config.identifier)
XCTAssertEqual(60.0, config.timeoutIntervalForRequest)
XCTAssertEqual(604800.0, config.timeoutIntervalForResource)
XCTAssertEqual(true, config.allowsCellularAccess)
#if !os(Linux)
//XCTAssertEqual(true, config.allowsExpensiveNetworkAccess)
XCTAssertEqual(true, config.allowsConstrainedNetworkAccess)
XCTAssertEqual(false, config.waitsForConnectivity)
XCTAssertEqual(false, config.isDiscretionary)
XCTAssertEqual(nil, config.sharedContainerIdentifier)
XCTAssertEqual(false, config.sessionSendsLaunchEvents)
//XCTAssertEqual(nil, config.connectionProxyDictionary)
#endif
XCTAssertEqual(false, config.httpShouldUsePipelining)
XCTAssertEqual(true, config.httpShouldSetCookies)
//XCTAssertEqual(nil, config.httpAdditionalHeaders)
Expand Down Expand Up @@ -270,6 +276,7 @@ class TestURLSession: XCTestCase {
}
}
}
#endif

//
//// These tests are adapted from https://github.com/apple/swift-corelibs-foundation/blob/main/Tests/Foundation/Tests which have the following license:
Expand Down
6 changes: 6 additions & 0 deletions Tests/SkipFoundationTests/SkipFoundationTests.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
// Copyright 2023–2025 Skip
// SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
import Foundation
#if SKIP || canImport(OSLog)
import OSLog
#endif
import XCTest
#if !SKIP
@testable import func SkipFoundation.SkipFoundationInternalModuleName
@testable import func SkipFoundation.SkipFoundationPublicModuleName
#endif

final class SkipFoundationTests: XCTestCase {
#if SKIP || canImport(OSLog)
let logger: Logger = Logger(subsystem: "test", category: "SkipFoundationTests")
#endif

func testSkipFoundation() throws {
XCTAssertEqual(3, 1 + 2)
Expand All @@ -25,7 +29,9 @@ final class SkipFoundationTests: XCTestCase {
if isRobolectric {
XCTAssertEqual(value, env[key], "Unexpected value for Robolectric system property \(key): \(env[key] ?? "")")
} else if isAndroidEmulator {
#if SKIP || canImport(OSLog)
logger.log("ANDROID ENV: \(key)=\(env[key] ?? "")")
#endif
XCTAssertNotNil(env[key], "Android system property should not been nil for key \(key)")
} else {
XCTAssertNil(env[key], "Swift system property should have been nil for key \(key) value=\(env[key] ?? "")")
Expand Down
4 changes: 4 additions & 0 deletions Tests/SkipFoundationTests/System/TestNotificationCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class TestNotificationCenter : XCTestCase {
XCTAssertTrue(flag)
}

#if SKIP || canImport(Darwin) // i.e., not Linux

func test_notificationsSequence() async {
let notificationCenter = NotificationCenter()
let notificationName = Notification.Name(rawValue: "test_notificationsSequence_name")
Expand Down Expand Up @@ -176,6 +178,8 @@ class TestNotificationCenter : XCTestCase {
XCTAssertEqual(count, 2)
}

#endif // SKIP || canImport(Darwin) // i.e., not Linux

func test_observeOnPostingQueue() {
#if SKIP
throw XCTSkip("TODO")
Expand Down
Loading
Loading