Test swift package init (executable)
Create a new package with an executable target.
RUN: rm -rf %t.dir
RUN: mkdir -p %t.dir/Project
RUN: %{swift-package} --package-path %t.dir/Project init --type executable
RUN: rm -rf %t.dir/Project/Sources/*
RUN: echo "print(\"Hello, World!\")" >%t.dir/Project/Sources/main.swift
RUN: %{swift-build} --package-path %t.dir/Project 2>&1 | tee %t.build-log
RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
CHECK-BUILD-LOG: Build complete!
Verify that the tool was built and works.
RUN: %{swift-build} --package-path %t.dir/Project --show-bin-path > %t.bin-path
RUN: sed 's|$|/Project|' %t.bin-path | xargs test -x
RUN: sed 's|$|/Project|' %t.bin-path | xargs sh -c '"$1" > %t.out' --
RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
CHECK-TOOL-OUTPUT: Hello, World!
Check there were no compile errors or warnings.
RUN: %{FileCheck} --check-prefix CHECK-NO-WARNINGS-OR-ERRORS --input-file %t.build-log %s
CHECK-NO-WARNINGS-OR-ERRORS-NOT: warning
CHECK-NO-WARNINGS-OR-ERRORS-NOT: error