Fix lint issues.

This commit is contained in:
Brent Simmons 2025-01-22 22:39:38 -08:00
parent b7f82944c7
commit ef4ae1bffe
5 changed files with 64 additions and 81 deletions

View File

@ -13,44 +13,44 @@ import XCTest
@testable import NetNewsWire @testable import NetNewsWire
class ArticleSorterTests: XCTestCase { class ArticleSorterTests: XCTestCase {
// MARK: sortByDate ascending tests // MARK: sortByDate ascending tests
func testSortByDateAscending() { func testSortByDateAscending() {
let now = Date() let now = Date()
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4") let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
let article2 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(60.0), sortableArticleID: "2", sortableFeedID: "6") let article2 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(60.0), sortableArticleID: "2", sortableFeedID: "6")
let article3 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(120.0), sortableArticleID: "3", sortableFeedID: "6") let article3 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(120.0), sortableArticleID: "3", sortableFeedID: "6")
let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-120.0), sortableArticleID: "4", sortableFeedID: "5") let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-120.0), sortableArticleID: "4", sortableFeedID: "5")
let articles = [article1, article2, article3, article4] let articles = [article1, article2, article3, article4]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, let sortedArticles = ArticleSorter.sortedByDate(articles: articles,
sortDirection: .orderedAscending, sortDirection: .orderedAscending,
groupByFeed: false) groupByFeed: false)
XCTAssertEqual(sortedArticles.count, articles.count) XCTAssertEqual(sortedArticles.count, articles.count)
XCTAssertEqual(sortedArticles.articleAtRow(0), article4) XCTAssertEqual(sortedArticles.articleAtRow(0), article4)
XCTAssertEqual(sortedArticles.articleAtRow(1), article1) XCTAssertEqual(sortedArticles.articleAtRow(1), article1)
XCTAssertEqual(sortedArticles.articleAtRow(2), article2) XCTAssertEqual(sortedArticles.articleAtRow(2), article2)
XCTAssertEqual(sortedArticles.articleAtRow(3), article3) XCTAssertEqual(sortedArticles.articleAtRow(3), article3)
} }
func testSortByDateAscendingWithSameDate() { func testSortByDateAscendingWithSameDate() {
let now = Date() let now = Date()
// Articles with the same date should end up being sorted by their article ID // Articles with the same date should end up being sorted by their article ID
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1") let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1")
let article2 = TestArticle(sortableName: "Matt's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "2") let article2 = TestArticle(sortableName: "Matt's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "2")
let article3 = TestArticle(sortableName: "Sally's Feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "3") let article3 = TestArticle(sortableName: "Sally's Feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "3")
let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: Date(timeInterval: -60.0, since: now), sortableArticleID: "4", sortableFeedID: "4") let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: Date(timeInterval: -60.0, since: now), sortableArticleID: "4", sortableFeedID: "4")
let article5 = TestArticle(sortableName: "Paul's Feed", sortableDate: Date(timeInterval: -120.0, since: now), sortableArticleID: "5", sortableFeedID: "5") let article5 = TestArticle(sortableName: "Paul's Feed", sortableDate: Date(timeInterval: -120.0, since: now), sortableArticleID: "5", sortableFeedID: "5")
let articles = [article1, article2, article3, article4, article5] let articles = [article1, article2, article3, article4, article5]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, let sortedArticles = ArticleSorter.sortedByDate(articles: articles,
sortDirection: .orderedAscending, sortDirection: .orderedAscending,
groupByFeed: false) groupByFeed: false)
XCTAssertEqual(sortedArticles.count, articles.count) XCTAssertEqual(sortedArticles.count, articles.count)
XCTAssertEqual(sortedArticles.articleAtRow(0), article5) XCTAssertEqual(sortedArticles.articleAtRow(0), article5)
XCTAssertEqual(sortedArticles.articleAtRow(1), article4) XCTAssertEqual(sortedArticles.articleAtRow(1), article4)
@ -58,7 +58,7 @@ class ArticleSorterTests: XCTestCase {
XCTAssertEqual(sortedArticles.articleAtRow(3), article2) XCTAssertEqual(sortedArticles.articleAtRow(3), article2)
XCTAssertEqual(sortedArticles.articleAtRow(4), article3) XCTAssertEqual(sortedArticles.articleAtRow(4), article3)
} }
func testSortByDateAscendingWithGroupByFeed() { func testSortByDateAscendingWithGroupByFeed() {
let now = Date() let now = Date()
@ -71,12 +71,12 @@ class ArticleSorterTests: XCTestCase {
let article7 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1") let article7 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1")
let article8 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "0") let article8 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "0")
let article9 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "0") let article9 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "0")
let articles = [article1, article2, article3, article4, article5, article6, article7, article8, article9] let articles = [article1, article2, article3, article4, article5, article6, article7, article8, article9]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, sortDirection: .orderedAscending, groupByFeed: true) let sortedArticles = ArticleSorter.sortedByDate(articles: articles, sortDirection: .orderedAscending, groupByFeed: true)
XCTAssertEqual(sortedArticles.count, 9) XCTAssertEqual(sortedArticles.count, 9)
// Gordy's feed articles // Gordy's feed articles
XCTAssertEqual(sortedArticles.articleAtRow(0), article4) XCTAssertEqual(sortedArticles.articleAtRow(0), article4)
XCTAssertEqual(sortedArticles.articleAtRow(1), article5) XCTAssertEqual(sortedArticles.articleAtRow(1), article5)
@ -93,42 +93,42 @@ class ArticleSorterTests: XCTestCase {
} }
// MARK: sortByDate descending tests // MARK: sortByDate descending tests
func testSortByDateDescending() { func testSortByDateDescending() {
let now = Date() let now = Date()
let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4") let article1 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-60.0), sortableArticleID: "1", sortableFeedID: "4")
let article2 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(60.0), sortableArticleID: "2", sortableFeedID: "6") let article2 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(60.0), sortableArticleID: "2", sortableFeedID: "6")
let article3 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(120.0), sortableArticleID: "3", sortableFeedID: "6") let article3 = TestArticle(sortableName: "Phil's Feed", sortableDate: now.addingTimeInterval(120.0), sortableArticleID: "3", sortableFeedID: "6")
let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-120.0), sortableArticleID: "4", sortableFeedID: "5") let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: now.addingTimeInterval(-120.0), sortableArticleID: "4", sortableFeedID: "5")
let articles = [article1, article2, article3, article4] let articles = [article1, article2, article3, article4]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, let sortedArticles = ArticleSorter.sortedByDate(articles: articles,
sortDirection: .orderedDescending, sortDirection: .orderedDescending,
groupByFeed: false) groupByFeed: false)
XCTAssertEqual(sortedArticles.count, articles.count) XCTAssertEqual(sortedArticles.count, articles.count)
XCTAssertEqual(sortedArticles.articleAtRow(0), article3) XCTAssertEqual(sortedArticles.articleAtRow(0), article3)
XCTAssertEqual(sortedArticles.articleAtRow(1), article2) XCTAssertEqual(sortedArticles.articleAtRow(1), article2)
XCTAssertEqual(sortedArticles.articleAtRow(2), article1) XCTAssertEqual(sortedArticles.articleAtRow(2), article1)
XCTAssertEqual(sortedArticles.articleAtRow(3), article4) XCTAssertEqual(sortedArticles.articleAtRow(3), article4)
} }
func testSortByDateDescendingWithSameDate() { func testSortByDateDescendingWithSameDate() {
let now = Date() let now = Date()
// Articles with the same date should end up being sorted by their article ID // Articles with the same date should end up being sorted by their article ID
let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1") let article1 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1")
let article2 = TestArticle(sortableName: "Matt's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "2") let article2 = TestArticle(sortableName: "Matt's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "2")
let article3 = TestArticle(sortableName: "Sally's Feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "3") let article3 = TestArticle(sortableName: "Sally's Feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "3")
let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: Date(timeInterval: -60.0, since: now), sortableArticleID: "4", sortableFeedID: "4") let article4 = TestArticle(sortableName: "Susie's Feed", sortableDate: Date(timeInterval: -60.0, since: now), sortableArticleID: "4", sortableFeedID: "4")
let article5 = TestArticle(sortableName: "Paul's Feed", sortableDate: Date(timeInterval: -120.0, since: now), sortableArticleID: "5", sortableFeedID: "5") let article5 = TestArticle(sortableName: "Paul's Feed", sortableDate: Date(timeInterval: -120.0, since: now), sortableArticleID: "5", sortableFeedID: "5")
let articles = [article1, article2, article3, article4, article5] let articles = [article1, article2, article3, article4, article5]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, let sortedArticles = ArticleSorter.sortedByDate(articles: articles,
sortDirection: .orderedDescending, sortDirection: .orderedDescending,
groupByFeed: false) groupByFeed: false)
XCTAssertEqual(sortedArticles.count, articles.count) XCTAssertEqual(sortedArticles.count, articles.count)
XCTAssertEqual(sortedArticles.articleAtRow(0), article1) XCTAssertEqual(sortedArticles.articleAtRow(0), article1)
XCTAssertEqual(sortedArticles.articleAtRow(1), article2) XCTAssertEqual(sortedArticles.articleAtRow(1), article2)
@ -136,7 +136,7 @@ class ArticleSorterTests: XCTestCase {
XCTAssertEqual(sortedArticles.articleAtRow(3), article4) XCTAssertEqual(sortedArticles.articleAtRow(3), article4)
XCTAssertEqual(sortedArticles.articleAtRow(4), article5) XCTAssertEqual(sortedArticles.articleAtRow(4), article5)
} }
func testSortByDateDescendingWithGroupByFeed() { func testSortByDateDescendingWithGroupByFeed() {
let now = Date() let now = Date()
@ -149,12 +149,12 @@ class ArticleSorterTests: XCTestCase {
let article7 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1") let article7 = TestArticle(sortableName: "Phil's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1")
let article8 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "0") let article8 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "0")
let article9 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "0") let article9 = TestArticle(sortableName: "Zippy's Feed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "0")
let articles = [article1, article2, article3, article4, article5, article6, article7, article8, article9] let articles = [article1, article2, article3, article4, article5, article6, article7, article8, article9]
let sortedArticles = ArticleSorter.sortedByDate(articles: articles, sortDirection: .orderedDescending, groupByFeed: true) let sortedArticles = ArticleSorter.sortedByDate(articles: articles, sortDirection: .orderedDescending, groupByFeed: true)
XCTAssertEqual(sortedArticles.count, 9) XCTAssertEqual(sortedArticles.count, 9)
// Gordy's feed articles // Gordy's feed articles
XCTAssertEqual(sortedArticles.articleAtRow(0), article5) XCTAssertEqual(sortedArticles.articleAtRow(0), article5)
XCTAssertEqual(sortedArticles.articleAtRow(1), article4) XCTAssertEqual(sortedArticles.articleAtRow(1), article4)
@ -169,12 +169,12 @@ class ArticleSorterTests: XCTestCase {
XCTAssertEqual(sortedArticles.articleAtRow(7), article8) XCTAssertEqual(sortedArticles.articleAtRow(7), article8)
XCTAssertEqual(sortedArticles.articleAtRow(8), article9) XCTAssertEqual(sortedArticles.articleAtRow(8), article9)
} }
// MARK: Additional group by feed tests // MARK: Additional group by feed tests
func testGroupByFeedWithCaseInsensitiveFeedNames() { func testGroupByFeedWithCaseInsensitiveFeedNames() {
let now = Date() let now = Date()
let article1 = TestArticle(sortableName: "phil's feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1") let article1 = TestArticle(sortableName: "phil's feed", sortableDate: now, sortableArticleID: "1", sortableFeedID: "1")
let article2 = TestArticle(sortableName: "PhIl's FEed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1") let article2 = TestArticle(sortableName: "PhIl's FEed", sortableDate: now, sortableArticleID: "2", sortableFeedID: "1")
let article3 = TestArticle(sortableName: "APPLE's feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "2") let article3 = TestArticle(sortableName: "APPLE's feed", sortableDate: now, sortableArticleID: "3", sortableFeedID: "2")
@ -187,7 +187,7 @@ class ArticleSorterTests: XCTestCase {
groupByFeed: true) groupByFeed: true)
XCTAssertEqual(sortedArticles.count, articles.count) XCTAssertEqual(sortedArticles.count, articles.count)
// Apple's feed articles // Apple's feed articles
XCTAssertEqual(sortedArticles.articleAtRow(0), article3) XCTAssertEqual(sortedArticles.articleAtRow(0), article3)
XCTAssertEqual(sortedArticles.articleAtRow(1), article5) XCTAssertEqual(sortedArticles.articleAtRow(1), article5)
@ -196,7 +196,7 @@ class ArticleSorterTests: XCTestCase {
XCTAssertEqual(sortedArticles.articleAtRow(3), article2) XCTAssertEqual(sortedArticles.articleAtRow(3), article2)
XCTAssertEqual(sortedArticles.articleAtRow(4), article4) XCTAssertEqual(sortedArticles.articleAtRow(4), article4)
} }
func testGroupByFeedWithSameFeedNames() { func testGroupByFeedWithSameFeedNames() {
let now = Date() let now = Date()
@ -219,7 +219,7 @@ class ArticleSorterTests: XCTestCase {
XCTAssertEqual(sortedArticles.articleAtRow(3), article2) XCTAssertEqual(sortedArticles.articleAtRow(3), article2)
XCTAssertEqual(sortedArticles.articleAtRow(4), article4) XCTAssertEqual(sortedArticles.articleAtRow(4), article4)
} }
} }
private struct TestArticle: SortableArticle, Equatable { private struct TestArticle: SortableArticle, Equatable {
@ -236,5 +236,5 @@ private extension Array where Element == TestArticle {
} }
return self[row] return self[row]
} }
} }

View File

@ -9,14 +9,6 @@
import XCTest import XCTest
class AppleScriptXCTestCase: XCTestCase { class AppleScriptXCTestCase: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
/* /*
@function doIndividualScript @function doIndividualScript
@ -28,39 +20,39 @@ class AppleScriptXCTestCase: XCTestCase {
if the test_result is false or is missing, the test fails if the test_result is false or is missing, the test fails
@return the value of script_result, if any @return the value of script_result, if any
*/ */
func doIndividualScript(filename:String) -> NSAppleEventDescriptor? { func doIndividualScript(filename: String) -> NSAppleEventDescriptor? {
var errorDict: NSDictionary? = nil var errorDict: NSDictionary?
let testBundle = Bundle(for: type(of: self)) let testBundle = Bundle(for: type(of: self))
let url = testBundle.url(forResource:filename, withExtension:"scpt") let url = testBundle.url(forResource: filename, withExtension: "scpt")
guard let testScriptUrl = url else { guard let testScriptUrl = url else {
XCTFail("Failed Getting script URL") XCTFail("Failed Getting script URL")
return nil return nil
} }
guard let testScript = NSAppleScript(contentsOf: testScriptUrl, error: &errorDict) else { guard let testScript = NSAppleScript(contentsOf: testScriptUrl, error: &errorDict) else {
print ("error is \(String(describing: errorDict))") print("error is \(String(describing: errorDict))")
XCTFail("Failed initializing NSAppleScript") XCTFail("Failed initializing NSAppleScript")
return nil return nil
} }
let scriptResult = testScript.executeAndReturnError(&errorDict) let scriptResult = testScript.executeAndReturnError(&errorDict)
if (errorDict != nil) { if errorDict != nil {
print ("error is \(String(describing: errorDict))") print("error is \(String(describing: errorDict))")
XCTFail("Failed executing script") XCTFail("Failed executing script")
return nil return nil
} }
let usrfDictionary = scriptResult.usrfDictionary() let usrfDictionary = scriptResult.usrfDictionary()
guard let testResult = usrfDictionary["test_result"] else { guard let testResult = usrfDictionary["test_result"] else {
XCTFail("test script didn't return test result in usrf") XCTFail("test script didn't return test result in usrf")
return nil return nil
} }
if (testResult.booleanValue != true) { if testResult.booleanValue != true {
print("test_result was \(testResult)") print("test_result was \(testResult)")
print("script_result was \(String(describing: usrfDictionary["script_result"]))") print("script_result was \(String(describing: usrfDictionary["script_result"]))")
} }
XCTAssert(testResult.booleanValue == true, "test_result should be true") XCTAssert(testResult.booleanValue == true, "test_result should be true")
return usrfDictionary["script_result"] return usrfDictionary["script_result"]
} }

View File

@ -17,23 +17,23 @@ import Foundation
returns an analogous Swift dictionary returns an analogous Swift dictionary
*/ */
extension NSAppleEventDescriptor { extension NSAppleEventDescriptor {
public func usrfDictionary() -> [String:NSAppleEventDescriptor] { public func usrfDictionary() -> [String: NSAppleEventDescriptor] {
guard self.isRecordDescriptor else { guard self.isRecordDescriptor else {
print ("error: usrfDictionary() expected input to be a record") print("error: usrfDictionary() expected input to be a record")
return [:] return [:]
} }
guard let usrfList = self.forKeyword("usrf".fourCharCode) else { guard let usrfList = self.forKeyword("usrf".fourCharCode) else {
print ("error: usrfDictionary() couldn't find usrf") print("error: usrfDictionary() couldn't find usrf")
return [:] return [:]
} }
let listCount = usrfList.numberOfItems let listCount = usrfList.numberOfItems
guard (listCount%2 == 0) else { guard listCount%2 == 0 else {
print ("error: usrfDictionary() expected even number of items in usrf") print("error: usrfDictionary() expected even number of items in usrf")
return [:] return [:]
} }
var usrfDictionary:[String:NSAppleEventDescriptor] = [:] var usrfDictionary: [String: NSAppleEventDescriptor] = [:]
var processedItems = 0 var processedItems = 0
while (processedItems < listCount) { while processedItems < listCount {
processedItems = processedItems + 2 processedItems = processedItems + 2
guard let nthlabel = usrfList.atIndex(processedItems-1) else { guard let nthlabel = usrfList.atIndex(processedItems-1) else {
print("usrfDictionary() couldn't get item \(processedItems+1) in usrf list") print("usrfDictionary() couldn't get item \(processedItems+1) in usrf list")
@ -49,6 +49,6 @@ extension NSAppleEventDescriptor {
} }
usrfDictionary[nthLabelString] = nthvalue usrfDictionary[nthLabelString] = nthvalue
} }
return usrfDictionary; return usrfDictionary
} }
} }

View File

@ -10,15 +10,6 @@ import XCTest
class ScriptingTests: AppleScriptXCTestCase { class ScriptingTests: AppleScriptXCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
/* /*
@function testGenericScript @function testGenericScript
@brief An example of how a script can be run as part of an XCTest @brief An example of how a script can be run as part of an XCTest
@ -31,27 +22,27 @@ class ScriptingTests: AppleScriptXCTestCase {
let scriptResult = doIndividualScript(filename: "testGenericScript") let scriptResult = doIndividualScript(filename: "testGenericScript")
XCTAssert( scriptResult?.stringValue == "Geoducks!") XCTAssert( scriptResult?.stringValue == "Geoducks!")
} }
func testGetUrlScript() { func testGetUrlScript() {
_ = doIndividualScript(filename: "testGetURL") _ = doIndividualScript(filename: "testGetURL")
} }
func testNameAndUrlOfEveryFeedScript() { func testNameAndUrlOfEveryFeedScript() {
_ = doIndividualScript(filename: "testNameAndUrlOfEveryFeed") _ = doIndividualScript(filename: "testNameAndUrlOfEveryFeed")
} }
func testNameOfEveryFolderScript() { func testNameOfEveryFolderScript() {
_ = doIndividualScript(filename: "testNameOfEveryFolder") _ = doIndividualScript(filename: "testNameOfEveryFolder")
} }
func testNameOfAuthorsScript() { func testNameOfAuthorsScript() {
_ = doIndividualScript(filename: "testNameOfAuthors") _ = doIndividualScript(filename: "testNameOfAuthors")
} }
func testFeedExists() { func testFeedExists() {
_ = doIndividualScript(filename: "testFeedExists") _ = doIndividualScript(filename: "testFeedExists")
} }
func testFeedOPML() { func testFeedOPML() {
_ = doIndividualScript(filename: "testFeedOPML") _ = doIndividualScript(filename: "testFeedOPML")
} }
@ -64,14 +55,14 @@ class ScriptingTests: AppleScriptXCTestCase {
// _ = doIndividualScriptWithExpectation(filename: "testIterativeCreateAndDeleteFeed") // _ = doIndividualScriptWithExpectation(filename: "testIterativeCreateAndDeleteFeed")
// } // }
func doIndividualScriptWithExpectation(filename:String) { func doIndividualScriptWithExpectation(filename: String) {
let queue = DispatchQueue(label:"testQueue") let queue = DispatchQueue(label: "testQueue")
let scriptExpectation = self.expectation(description: filename+"expectation") let scriptExpectation = self.expectation(description: filename+"expectation")
queue.async { queue.async {
_ = self.doIndividualScript(filename:filename) _ = self.doIndividualScript(filename: filename)
scriptExpectation.fulfill() scriptExpectation.fulfill()
} }
self.wait(for:[scriptExpectation], timeout:60) self.wait(for: [scriptExpectation], timeout: 60)
} }
/* /*
@ -90,7 +81,7 @@ class ScriptingTests: AppleScriptXCTestCase {
this test is disabled. this test is disabled.
*/ */
func disabledTestCurrentArticleScripts() { func disabledTestCurrentArticleScripts() {
doIndividualScriptWithExpectation(filename: "uiScriptingTestSetup") doIndividualScriptWithExpectation(filename: "uiScriptingTestSetup")
doIndividualScriptWithExpectation(filename: "establishMainWindowStartingState") doIndividualScriptWithExpectation(filename: "establishMainWindowStartingState")
doIndividualScriptWithExpectation(filename: "selectAFeed") doIndividualScriptWithExpectation(filename: "selectAFeed")

View File

@ -19,7 +19,7 @@ class SharingTests: XCTestCase {
sharingService.delegate = sharingServiceDelegate sharingService.delegate = sharingServiceDelegate
sharingService.perform(withItems: [ sharingService.perform(withItems: [
ArticlePasteboardWriter(article: article(titled: "Immunization")), ArticlePasteboardWriter(article: article(titled: "Immunization"))
]) ])
XCTAssertEqual("Immunization", sharingService.subject) XCTAssertEqual("Immunization", sharingService.subject)
@ -32,7 +32,7 @@ class SharingTests: XCTestCase {
sharingService.delegate = sharingServiceDelegate sharingService.delegate = sharingServiceDelegate
sharingService.perform(withItems: [ sharingService.perform(withItems: [
ArticlePasteboardWriter(article: article(titled: "NetNewsWire Status: Almost Beta")), ArticlePasteboardWriter(article: article(titled: "NetNewsWire Status: Almost Beta")),
ArticlePasteboardWriter(article: article(titled: "No Algorithms Follow-Up")), ArticlePasteboardWriter(article: article(titled: "No Algorithms Follow-Up"))
]) ])
XCTAssertEqual("NetNewsWire Status: Almost Beta, No Algorithms Follow-Up", sharingService.subject) XCTAssertEqual("NetNewsWire Status: Almost Beta, No Algorithms Follow-Up", sharingService.subject)