Skip to content

Commit

Permalink
Fixed linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Sep 29, 2021
1 parent 2db44f9 commit 70cc847
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CoreLocation
@testable import MapboxMaps

// Disabling rules against force casting for test file.
// swiftlint:disable explicit_top_level_acl explicit_acl force_try force_cast
// swiftlint:disable explicit_top_level_acl explicit_acl force_try
class FeatureCollectionTests: XCTestCase {

func testFeatureCollection() {
Expand Down Expand Up @@ -88,13 +88,17 @@ class FeatureCollectionTests: XCTestCase {
func testFeatureCollectionDecodeWithoutProperties() {
let data = try! Fixture.geojsonData(from: "featurecollection-no-properties")!
let geojson = try! JSONDecoder().decode(GeoJSONObject.self, from: data)
if case .featureCollection = geojson {} else { XCTFail() }
if case .featureCollection = geojson {} else {
XCTFail("GeoJSON should decode as a feature collection.")
}
}

func testUnkownFeatureCollection() {
let data = try! Fixture.geojsonData(from: "featurecollection")!
let geojson = try! JSONDecoder().decode(GeoJSONObject.self, from: data)
if case .featureCollection = geojson {} else { XCTFail() }
if case .featureCollection = geojson {} else {
XCTFail("GeoJSON should decode as a feature collection.")
}
}

func testPerformanceDecodeFeatureCollection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest
import CoreLocation
@testable import MapboxMaps

// swiftlint:disable explicit_top_level_acl explicit_acl force_try force_cast
// swiftlint:disable explicit_top_level_acl explicit_acl force_try
let metersPerMile: CLLocationDistance = 1_609.344

class LineStringTests: XCTestCase {
Expand Down
6 changes: 4 additions & 2 deletions Tests/MapboxMapsTests/Foundation/GeoJSON/PointTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CoreLocation
@testable import MapboxMaps

// Disabling rules against force casting for test file.
// swiftlint:disable explicit_top_level_acl explicit_acl force_try force_cast
// swiftlint:disable explicit_top_level_acl explicit_acl force_try
class PointTests: XCTestCase {

func testPointFeature() {
Expand All @@ -29,6 +29,8 @@ class PointTests: XCTestCase {
let geojson = try! JSONDecoder().decode(GeoJSONObject.self, from: data)

if case let .feature(feature) = geojson,
case .point = feature.geometry {} else { XCTFail() }
case .point = feature.geometry {} else {
XCTFail("GeoJSON should decode as a point feature.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CoreLocation
@testable import MapboxMaps

// Disabling rules against force casting for test file.
// swiftlint:disable explicit_top_level_acl explicit_acl force_try force_cast
// swiftlint:disable explicit_top_level_acl explicit_acl force_try
class PolygonTests: XCTestCase {

func testPolygonFeature() {
Expand Down
4 changes: 3 additions & 1 deletion Tests/MapboxMapsTests/Style/GeoJSONSourceDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class GeoJSONSourceDataTests: XCTestCase {
if let validData = decodedSource?.data,
case let GeoJSONSourceData.feature(feature) = validData {
XCTAssert(feature.identifier != nil)
if case .point = feature.geometry {} else { XCTFail() }
if case .point = feature.geometry {} else {
XCTFail("Geometry of the decoded feature should be a point.")
}
} else {
XCTFail("Failed to read decoded geojson fixture.")
}
Expand Down

0 comments on commit 70cc847

Please sign in to comment.