From a568b40ddc5b75cec37169796e2c4d93cd735ec1 Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Wed, 8 Jun 2022 22:50:04 +0100 Subject: [PATCH] Initial commit --- .gitignore | 9 +++++ Package.swift | 22 ++++++++++ README.md | 3 ++ Sources/fancyclip/.main.swift.swp | Bin 0 -> 12288 bytes Sources/fancyclip/main.swift | 17 ++++++++ Tests/fancyclipTests/fancyclipTests.swift | 47 ++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 Package.swift create mode 100644 README.md create mode 100644 Sources/fancyclip/.main.swift.swp create mode 100755 Sources/fancyclip/main.swift create mode 100644 Tests/fancyclipTests/fancyclipTests.swift diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b29812 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..65403c7 --- /dev/null +++ b/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version: 5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "fancyclip", + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .executableTarget( + name: "fancyclip", + dependencies: []), + .testTarget( + name: "fancyclipTests", + dependencies: ["fancyclip"]), + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab21841 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# fancyclip + +A description of this package. diff --git a/Sources/fancyclip/.main.swift.swp b/Sources/fancyclip/.main.swift.swp new file mode 100644 index 0000000000000000000000000000000000000000..094450aeab928a7058d0232ea6a84071fe348210 GIT binary patch literal 12288 zcmeI2PiqrF6u@75um3;5bOqTF-TdjLmb752q7bDR>!q8+WOp`QIy<|}%urugLy?B%gf>+-rDViD+ugV+vu{$$w-kbN!DI~r6!#j7`a?k`EX8?}gz3lN< z{`}!0fY3VK71hS{p-L?RCG_+tfTzQRwHwmzy1b|*LPz_NN{d=2FHI!vFDscybzt|> z#Ldb|`(%I&%rsECfDDj3mTxtV7bTIeg$lhujw99U=i5ye|IvF2T2Np2qO7jlIKJ1$ckCg<56 z7E-+H4{P(Wqjpek>~N%{FdMmcQakH&P|~rVx!Eea*V(Mp^ag7BQcEKg48pKC+~3Hv zOz60sY8eRAFS9DqcC$MOsk;7iP@@a*1Q-taD0O~=58jia#G81f6@6?s^rI~1tbKj` zW}9u@Z-*K?vM!d!a7dHM<%1|MwPP)|#2ydtib?RU{^ZNnyG&SYbogm-{1d))o5Jm2 bbdhW92Oz~a\(label)", forType: .html) diff --git a/Tests/fancyclipTests/fancyclipTests.swift b/Tests/fancyclipTests/fancyclipTests.swift new file mode 100644 index 0000000..c9d1960 --- /dev/null +++ b/Tests/fancyclipTests/fancyclipTests.swift @@ -0,0 +1,47 @@ +import XCTest +import class Foundation.Bundle + +final class fancyclipTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + + // Some of the APIs that we use below are available in macOS 10.13 and above. + guard #available(macOS 10.13, *) else { + return + } + + // Mac Catalyst won't have `Process`, but it is supported for executables. + #if !targetEnvironment(macCatalyst) + + let fooBinary = productsDirectory.appendingPathComponent("fancyclip") + + let process = Process() + process.executableURL = fooBinary + + let pipe = Pipe() + process.standardOutput = pipe + + try process.run() + process.waitUntilExit() + + let data = pipe.fileHandleForReading.readDataToEndOfFile() + let output = String(data: data, encoding: .utf8) + + XCTAssertEqual(output, "Hello, world!\n") + #endif + } + + /// Returns path to the built products directory. + var productsDirectory: URL { + #if os(macOS) + for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { + return bundle.bundleURL.deletingLastPathComponent() + } + fatalError("couldn't find the products directory") + #else + return Bundle.main.bundleURL + #endif + } +}