diff --git a/tests/PHP Monitor.xctestplan b/tests/PHP Monitor.xctestplan index 81846323..751aafb1 100644 --- a/tests/PHP Monitor.xctestplan +++ b/tests/PHP Monitor.xctestplan @@ -13,6 +13,15 @@ }, "testTargets" : [ { + "parallelizable" : true, + "target" : { + "containerPath" : "container:PHP Monitor.xcodeproj", + "identifier" : "C4F7807825D7F84B000DBC97", + "name" : "Unit Tests" + } + }, + { + "enabled" : false, "parallelizable" : false, "target" : { "containerPath" : "container:PHP Monitor.xcodeproj", @@ -26,15 +35,6 @@ "identifier" : "C471E7BB28F9B90F0021E251", "name" : "UI Tests" } - }, - { - "enabled" : false, - "parallelizable" : false, - "target" : { - "containerPath" : "container:PHP Monitor.xcodeproj", - "identifier" : "C4F7807825D7F84B000DBC97", - "name" : "Unit Tests" - } } ], "version" : 1 diff --git a/tests/unit/SwiftTestMigrated/Testables/Shell/RealShellTest.swift b/tests/unit/SwiftTestMigrated/Testables/Shell/RealShellTest.swift index 1010c242..3a771c4c 100644 --- a/tests/unit/SwiftTestMigrated/Testables/Shell/RealShellTest.swift +++ b/tests/unit/SwiftTestMigrated/Testables/Shell/RealShellTest.swift @@ -18,28 +18,24 @@ struct RealShellTest { container = Container.real() } - var Shell: ShellProtocol { - return container.shell - } - @Test func system_shell_is_default() async { - #expect(Shell is RealShell) + #expect(container.shell is RealShell) - let output = await Shell.pipe("php -v") + let output = await container.shell.pipe("php -v") #expect(output.out.contains("Copyright (c) The PHP Group")) } @Test func system_shell_can_be_used_synchronously() { - #expect(Shell is RealShell) + #expect(container.shell is RealShell) - let output = Shell.sync("php -v") + let output = container.shell.sync("php -v") #expect(output.out.contains("Copyright (c) The PHP Group")) } @Test func system_shell_has_path() { - let systemShell = Shell as! RealShell + let systemShell = container.shell as! RealShell #expect(systemShell.PATH.contains(":/usr/local/bin")) #expect(systemShell.PATH.contains(":/usr/bin")) @@ -48,22 +44,20 @@ struct RealShellTest { @Test func system_shell_can_buffer_output() async { var bits: [String] = [] - let (_, shellOutput) = try! await Shell.attach( - "php -r \"echo 'Hello world' . PHP_EOL; usleep(200); echo 'Goodbye world';\"", + let (_, shellOutput) = try! await container.shell.attach( + "php -r \"echo 'Hello world' . PHP_EOL; usleep(500); echo 'Goodbye world';\"", didReceiveOutput: { incoming, _ in bits.append(incoming) }, withTimeout: 2.0 ) - #expect(bits.contains("Hello world\n")) - #expect(bits.contains("Goodbye world")) #expect("Hello world\nGoodbye world" == shellOutput.out) } @Test func system_shell_can_timeout_and_throw_error() async { await #expect(throws: ShellError.timedOut) { - try await Shell.attach( + try await container.shell.attach( "php -r \"sleep(1);\"", didReceiveOutput: { _, _ in }, withTimeout: .seconds(0.1) @@ -75,9 +69,9 @@ struct RealShellTest { let start = ContinuousClock.now await withTaskGroup(of: Void.self) { group in - group.addTask { await Shell.quiet("php -r \"usleep(700000);\"") } - group.addTask { await Shell.quiet("php -r \"usleep(700000);\"") } - group.addTask { await Shell.quiet("php -r \"usleep(700000);\"") } + group.addTask { await container.shell.quiet("php -r \"usleep(700000);\"") } + group.addTask { await container.shell.quiet("php -r \"usleep(700000);\"") } + group.addTask { await container.shell.quiet("php -r \"usleep(700000);\"") } } let duration = start.duration(to: .now)