Skip to content

Commit 1d5d149

Browse files
authored
Merge pull request #23 from hartbit/swift-run
Add a test for the new swift run command
2 parents db6f71e + 549de4f commit 1d5d149

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

swift-run.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Test `swift run` (executable)
2+
3+
## Create a new package with an echo executable.
4+
5+
```
6+
RUN: rm -rf %t.dir
7+
RUN: mkdir -p %t.dir/secho
8+
RUN: %{swift} package --package-path %t.dir/secho init --type executable
9+
RUN: echo "import Foundation; print(CommandLine.arguments.dropFirst().joined(separator: \" \"))" >%t.dir/secho/Sources/secho/main.swift
10+
RUN: %{swift} run --package-path %t.dir/secho secho 1 "two" 2>&1 | tee %t.run-log
11+
```
12+
13+
## Check the run log.
14+
15+
```
16+
RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.run-log %s
17+
```
18+
19+
```
20+
CHECK-BUILD-LOG: Compile Swift Module 'secho'
21+
CHECK-BUILD-LOG: Linking {{.*}}secho
22+
CHECK-BUILD-LOG: 1 two
23+
```

0 commit comments

Comments
 (0)