Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit a7edbeb

Browse files
committed
add sample and test files
1 parent 8f21fcd commit a7edbeb

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed

examples/swiftModules/today.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// a swift module file
2+
3+
import Foundation
4+
5+
public func printToday(){
6+
let date = Date()
7+
let dateFormatter = DateFormatter()
8+
9+
dateFormatter.dateStyle = .full
10+
dateFormatter.timeStyle = .full
11+
12+
let dateString = dateFormatter.string(from: date as Date)
13+
print("Welcome to Swift")
14+
print("Today is \(dateString)")
15+
}

examples/swiftProjects/hellolib.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// a swift project file
2+
3+
import Foundation
4+
import Today
5+
6+
print("Hello World")
7+
printToday() // func from libToday library
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// a swift project file
2+
// include: today.swift
3+
4+
import Foundation
5+
6+
print("Hello World")
7+
8+
printToday() // func from today.swift
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// a swift project file
2+
3+
print("Hello World")

examples/test.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
echo "Starting Test 1 - helloworld"
4+
echo
5+
pushd swiftProjects/ || exit
6+
echo "Building Test 1 - helloworld"
7+
echo
8+
swiftx build helloworld.swift
9+
echo "Running Test 1 - helloworld"
10+
echo
11+
./helloworld
12+
popd || exit
13+
echo "End Test 1 - helloworld"
14+
echo
15+
echo "Starting Test 2 - hellomodule"
16+
echo
17+
pushd swiftProjects/ || exit
18+
echo "Building Test 2 - hellomodule"
19+
echo
20+
swiftx build hellomodule.swift
21+
echo "Running Test 2 - hellomodule"
22+
echo
23+
./hellomodule
24+
popd || exit
25+
echo "End Test 2 - hellomodule"
26+
echo
27+
echo "Starting Test 3 - libToday"
28+
echo
29+
pushd swiftModules/ || exit
30+
echo "Building Test 3 - libToday"
31+
echo
32+
printf "today\n1.0.0\n" | swiftx create today.swift -p
33+
echo "Installing Test 3 - libToday"
34+
echo
35+
sudo apt install -y ./libToday_1.0.0.deb
36+
popd || exit
37+
echo "End Test 3 - libToday"
38+
echo
39+
echo "Starting Test 4 - hellolib"
40+
echo
41+
pushd swiftProjects/ || exit
42+
echo "Building Test 4 - hellolib"
43+
echo
44+
swiftx build hellolib.swift
45+
echo "Running Test 4 - hellolib"
46+
echo
47+
./hellolib
48+
popd || exit
49+
echo "End Test 4 - hellolib"
50+
echo
51+
echo "**** All Tests Completed ****"

0 commit comments

Comments
 (0)