File tree 3 files changed +49
-4
lines changed
3 files changed +49
-4
lines changed Original file line number Diff line number Diff line change 6
6
RUN: rm -rf %t.dir
7
7
RUN: mkdir -p %t.dir/Project
8
8
RUN: %{swift-package} --package-path %t.dir/Project init --type executable
9
- RUN: rm -rf %t.dir/Project/Sources/Project/ *
10
- RUN: echo "print(\"Hello, World!\")" >%t.dir/Project/Sources/Project/ main.swift
9
+ RUN: rm -rf %t.dir/Project/Sources/*
10
+ RUN: echo "print(\"Hello, World!\")" >%t.dir/Project/Sources/main.swift
11
11
RUN: %{swift-build} --package-path %t.dir/Project 2>&1 | tee %t.build-log
12
12
```
13
13
Original file line number Diff line number Diff line change
1
+ # Test ` swift package init ` (tool)
2
+
3
+ ## Create a new package with a tool target.
4
+
5
+ ```
6
+ RUN: rm -rf %t.dir
7
+ RUN: mkdir -p %t.dir/Project
8
+ RUN: %{swift-package} --package-path %t.dir/Project init --type tool
9
+ RUN: rm -rf %t.dir/Project/Sources/*
10
+ RUN: %{swift-build} --package-path %t.dir/Project 2>&1 | tee %t.build-log
11
+ ```
12
+
13
+ ## Check the build log.
14
+
15
+ ```
16
+ RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
17
+ ```
18
+
19
+ ```
20
+ CHECK-BUILD-LOG: Compiling {{.*}}Project{{.*}}
21
+ CHECK-BUILD-LOG: Linking {{.*}}Project
22
+ ```
23
+
24
+ ## Verify that the tool was built and works.
25
+
26
+ ```
27
+ RUN: test -x %t.dir/Project/.build/debug/Project
28
+ RUN: %t.dir/Project/.build/debug/Project > %t.out
29
+ RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
30
+ ```
31
+
32
+ ```
33
+ CHECK-TOOL-OUTPUT: Hello, World!
34
+ ```
35
+
36
+ ## Check there were no compile errors or warnings.
37
+
38
+ ```
39
+ RUN: %{FileCheck} --check-prefix CHECK-NO-WARNINGS-OR-ERRORS --input-file %t.build-log %s
40
+ ```
41
+
42
+ ```
43
+ CHECK-NO-WARNINGS-OR-ERRORS-NOT: warning
44
+ CHECK-NO-WARNINGS-OR-ERRORS-NOT: error
45
+ ```
Original file line number Diff line number Diff line change 6
6
RUN: rm -rf %t.dir
7
7
RUN: mkdir -p %t.dir/secho
8
8
RUN: %{swift-package} --package-path %t.dir/secho init --type executable
9
- RUN: rm -rf %t.dir/secho/Sources/secho/ *
10
- RUN: echo "import Foundation; print(CommandLine.arguments.dropFirst().joined(separator: \" \"))" >%t.dir/secho/Sources/secho/ main.swift
9
+ RUN: rm -rf %t.dir/secho/Sources/*
10
+ RUN: echo "import Foundation; print(CommandLine.arguments.dropFirst().joined(separator: \" \"))" >%t.dir/secho/Sources/main.swift
11
11
RUN: %{swift-run} --package-path %t.dir/secho secho 1 "two" 2>&1 | tee %t.run-log
12
12
```
13
13
You can’t perform that action at this time.
0 commit comments