File tree Expand file tree Collapse file tree 7 files changed +62
-6
lines changed Expand file tree Collapse file tree 7 files changed +62
-6
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ let package = Package(
3636 ]
3737 ) ,
3838 . testTarget(
39- name: " ReleaseNotesCoreTests " ,
39+ name: " ReleaseNotesTests " ,
4040 dependencies: [ " ReleaseNotesCore " ]
4141 ) ,
4242 ]
Original file line number Diff line number Diff line change 11import ArgumentParser
22
33
4- @main
5- struct App {
6- static func main( ) async {
4+ public struct App {
5+ public static func main( ) async {
76 await ReleaseNotes . main ( )
87 }
98}
Original file line number Diff line number Diff line change 11import Parsing
22import SemanticVersion
3- import Darwin
43
54
65enum Parser {
Original file line number Diff line number Diff line change 1+ import Foundation
2+ import ReleaseNotesCore
3+
4+
5+ let group = DispatchGroup ( )
6+ group. enter ( )
7+ Task {
8+ defer { group. leave ( ) }
9+ await App . main ( )
10+ }
11+
12+ group. wait ( )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import XCTest
2+ import class Foundation. Bundle
3+
4+
5+ final class LaunchTests : XCTestCase {
6+
7+ func test_launch( ) throws {
8+ let process = Process ( )
9+ process. executableURL = productsDirectory
10+ . appendingPathComponent ( " swift-release-notes " )
11+ process. arguments = [ " --help " ]
12+
13+ let pipe = Pipe ( )
14+ process. standardOutput = pipe
15+
16+ try process. run ( )
17+ process. waitUntilExit ( )
18+
19+ let data = pipe. fileHandleForReading. readDataToEndOfFile ( )
20+ let output = try XCTUnwrap ( String ( data: data, encoding: . utf8) )
21+
22+ XCTAssertEqual ( output, """
23+ USAGE: release-notes [<working-direcory>]
24+
25+ ARGUMENTS:
26+ <working-direcory> (default: .)
27+
28+ OPTIONS:
29+ -h, --help Show help information.
30+
31+
32+ """ )
33+ }
34+
35+ /// Returns path to the built products directory.
36+ var productsDirectory : URL {
37+ #if os(macOS)
38+ for bundle in Bundle . allBundles where bundle. bundlePath. hasSuffix ( " .xctest " ) {
39+ return bundle. bundleURL. deletingLastPathComponent ( )
40+ }
41+ fatalError ( " couldn't find the products directory " )
42+ #else
43+ return Bundle . main. bundleURL
44+ #endif
45+ }
46+
47+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments