Skip to content

Commit 6586f40

Browse files
committed
add test for multiplePlatforms
1 parent 250ee36 commit 6586f40

File tree

3 files changed

+29
-35
lines changed

3 files changed

+29
-35
lines changed

test/BinaryWatch Extension/ExtensionDelegate.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,4 @@ class ExtensionDelegate: NSObject, WKExtensionDelegate {
1818
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
1919
}
2020

21-
func applicationWillResignActive() {
22-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
23-
// Use this method to pause ongoing tasks, disable timers, etc.
24-
}
25-
26-
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
27-
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
28-
for task in backgroundTasks {
29-
// Use a switch statement to check the task type
30-
switch task {
31-
case let backgroundTask as WKApplicationRefreshBackgroundTask:
32-
// Be sure to complete the background task once you’re done.
33-
backgroundTask.setTaskCompletedWithSnapshot(false)
34-
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
35-
// Snapshot tasks have a unique completion call, make sure to set your expiration date
36-
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
37-
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
38-
// Be sure to complete the connectivity task once you’re done.
39-
connectivityTask.setTaskCompletedWithSnapshot(false)
40-
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
41-
// Be sure to complete the URL session task once you’re done.
42-
urlSessionTask.setTaskCompletedWithSnapshot(false)
43-
case let relevantShortcutTask as WKRelevantShortcutRefreshBackgroundTask:
44-
// Be sure to complete the relevant-shortcut task once you're done.
45-
relevantShortcutTask.setTaskCompletedWithSnapshot(false)
46-
case let intentDidRunTask as WKIntentDidRunRefreshBackgroundTask:
47-
// Be sure to complete the intent-did-run task once you're done.
48-
intentDidRunTask.setTaskCompletedWithSnapshot(false)
49-
default:
50-
// make sure to complete unhandled task types
51-
task.setTaskCompletedWithSnapshot(false)
52-
}
53-
}
54-
}
55-
5621
}

test/change_podfile.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ def save_to_podfile(text):
2525
file.write(text[1])
2626
file.close()
2727

28+
path = os.path.dirname(os.path.abspath(__file__))
29+
path += "/BinaryWatch Extension/import.swift"
30+
file = open(path, "w+")
31+
file.write( "" if len(text) <= 2 else text[2])
32+
file.close()
33+
2834

2935

3036
def initial():
@@ -133,6 +139,24 @@ def universalFlag():
133139
import AFNetworking
134140
""")
135141

142+
def multiplePlatforms():
143+
return (wrapper(
144+
"""
145+
pod "Literal", :binary => true
146+
pod "AFNetworking/Reachability", :binary => true
147+
end
148+
149+
target 'BinaryWatch Extension' do
150+
pod ""Literal""
151+
""") ,
152+
"""
153+
import Literal
154+
import AFNetworking
155+
""",
156+
"""
157+
import Literal
158+
"""
159+
)
136160

137161

138162

test/test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ python change_podfile.py "addVendoredLibPod"
4141
pod install
4242
build
4343

44+
#
45+
python change_podfile.py "multiplePlatforms"
46+
pod install
47+
build
48+
4449
#
4550
python change_podfile.py "universalFlag"
4651
pod install

0 commit comments

Comments
 (0)