Merge pull request #249 from ABridoux/release/4.0.2

Release 4.0.2
This commit is contained in:
Alexis Bridoux 2021-05-08 15:52:34 +02:00 committed by GitHub
commit 66bc30353e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 336 deletions

View File

@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file. `Scout` adheres to [Semantic Versioning](http://semver.org).
---
## [4.0.2](https://github.com/ABridoux/scout/tree/4.0.2) (08/05/2021)
### Changed
- Removed useless `indirect` attribute on `ExplorerValue` enum.
- Deprecated `PathExplorer.real` for `PathExplorer.double`.
## [4.0.1](https://github.com/ABridoux/scout/tree/4.0.1) (02/05/2021)
### Fixed
- Date decoding and `PathExplorer.date` [#239]

View File

@ -11,7 +11,7 @@ public extension Parser {
static func character(matching condition: @escaping (Character) -> Bool) -> Parser<Character> {
Parser<Character> { input in
guard let char = input.first, condition(char) else { return nil }
guard let char = input.first, condition(char) else { return nil }
return (char, input.dropFirst())
}
}

View File

@ -4,5 +4,5 @@
// MIT license, see LICENSE file for details
public enum ScoutVersion {
public static let current = "4.0.1"
public static let current = "4.0.2"
}

View File

@ -6,11 +6,7 @@
import Foundation
/// The values a `PathExplorer` can take
public indirect enum ExplorerValue {
public typealias ArrayValue = [ExplorerValue]
public typealias DictionaryValue = [String: ExplorerValue]
typealias SlicePath = Slice<Path>
public enum ExplorerValue {
// single
case int(Int)
@ -25,6 +21,12 @@ public indirect enum ExplorerValue {
case dictionary(DictionaryValue)
}
extension ExplorerValue {
public typealias ArrayValue = [ExplorerValue]
public typealias DictionaryValue = [String: ExplorerValue]
typealias SlicePath = Slice<Path>
}
extension ExplorerValue {
public var isSingle: Bool { !isGroup }
@ -267,6 +269,7 @@ extension ExplorerValue {
return double
}
@available(*, deprecated, renamed: "double")
public var real: Double? { double }
public var string: String? {

View File

@ -17,7 +17,7 @@ public struct CodablePathExplorer<Format: CodableFormat>: PathExplorer {
public var int: Int? { value.int }
@available(*, deprecated, renamed: "double")
public var real: Double? { value.real }
public var double: Double? { value.real }
public var double: Double? { value.double }
public var data: Data? { value.data }
public func array<T>(of type: T.Type) throws -> [T] where T: ExplorerValueCreatable { try value.array(of: type) }
public func dictionary<T>(of type: T.Type) throws -> [String: T] where T: ExplorerValueCreatable { try value.dictionary(of: type) }

View File

@ -29,6 +29,7 @@ where
var int: Int? { get }
/// Non `nil` if the key is of the `Double` type
@available(*, deprecated, renamed: "double")
var real: Double? { get }
/// Non `nil` if the key is of the `Double` type

View File

@ -1,8 +0,0 @@
import XCTest
import ScoutTests
var tests = [XCTestCaseEntry]()
tests += ScoutTests.__allTests()
XCTMain(tests)

View File

@ -131,7 +131,7 @@ final class PathExplorerGetTests: XCTestCase {
XCTAssertEqual(try explorer.get(0).string, "Endo")
XCTAssertEqual(try explorer.get(1).int, 1)
XCTAssertEqual(try explorer.get(2).bool, false)
XCTAssertEqual(try explorer.get(3).real, 2.5)
XCTAssertEqual(try explorer.get(3).double, 2.5)
}
func testGetIndex_LastIndex<P: EquatablePathExplorer>(_ type: P.Type) throws {

View File

@ -1,319 +0,0 @@
#if !canImport(ObjectiveC)
import XCTest
extension ArrayExtensionsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ArrayExtensionsTests = [
("testDeleteRange1", testDeleteRange1),
("testDeleteRange2", testDeleteRange2),
("testDeleteRange3", testDeleteRange3)
]
}
extension BoundsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__BoundsTests = [
("testEqualBound", testEqualBound),
("testGetArraySlice_FirstIndex", testGetArraySlice_FirstIndex),
("testGetArraySlice_LastIndex", testGetArraySlice_LastIndex),
("testGetArraySlice_LowerGreaterThanLastIndexThrows", testGetArraySlice_LowerGreaterThanLastIndexThrows),
("testGetArraySlice_LowerNegative", testGetArraySlice_LowerNegative),
("testGetArraySlice_LowerNegativeAndUpperEquals0Throws", testGetArraySlice_LowerNegativeAndUpperEquals0Throws),
("testGetArraySlice_UpperLesserThanLowerThrows", testGetArraySlice_UpperLesserThanLowerThrows),
("testGetArraySlice_UpperNegative", testGetArraySlice_UpperNegative),
("testGetArraySlice", testGetArraySlice),
("testNotEqualsBound", testNotEqualsBound),
("testNotEqualsBoundWithIdentifier", testNotEqualsBoundWithIdentifier),
("testRange_LowerNegativeGreaterThanUpperThrows", testRange_LowerNegativeGreaterThanUpperThrows),
("testRange_UpperNegativeLesserThanLowerThrows", testRange_UpperNegativeLesserThanLowerThrows)
]
}
extension KeyTypeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__KeyTypeTests = [
("testInitBoolFromString1", testInitBoolFromString1),
("testInitBoolFromString2", testInitBoolFromString2),
("testInitDoubleFromString", testInitDoubleFromString),
("testInitIntFromString", testInitIntFromString)
]
}
extension NSRegularExpressionExtensionsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__NSRegularExpressionExtensionsTests = [
("testValidate1", testValidate1),
("testValidate2", testValidate2)
]
}
extension PathExplorerSerializationTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PathExplorerSerializationTests = [
("testAddCount_ThrowsError", testAddCount_ThrowsError),
("testAddKey1", testAddKey1),
("testAddKey2", testAddKey2),
("testAddKey3", testAddKey3),
("testAddKeyArrayEnd", testAddKeyArrayEnd),
("testAddKeyArrayInsert", testAddKeyArrayInsert),
("testAddKeyDict", testAddKeyDict),
("testAddToArray_ThrowsIfNonIndex", testAddToArray_ThrowsIfNonIndex),
("testAddToArray_ThrowsIfWrongIndex", testAddToArray_ThrowsIfWrongIndex),
("testAddToDictionary_ThrowsIfNonKey", testAddToDictionary_ThrowsIfNonKey),
("testArrayStringFilter", testArrayStringFilter),
("testCSVArray", testCSVArray),
("testCSVArrayOfArrays", testCSVArrayOfArrays),
("testCSVArrayOfDictionary", testCSVArrayOfDictionary),
("testCSVDictionaryOfArrays", testCSVDictionaryOfArrays),
("testCSVSingleValues", testCSVSingleValues),
("testDecodeRootArray", testDecodeRootArray),
("testDelete_ThrowsIfWrongIndex", testDelete_ThrowsIfWrongIndex),
("testDeleteArrayStringFilter", testDeleteArrayStringFilter),
("testDeleteCount_ThrowsError", testDeleteCount_ThrowsError),
("testDeleteDictionaryFilterIndex", testDeleteDictionaryFilterIndex),
("testDeleteDictionaryFilterKey", testDeleteDictionaryFilterKey),
("testDeleteFilter", testDeleteFilter),
("testDeleteFilterFilter", testDeleteFilterFilter),
("testDeleteFilterSlice", testDeleteFilterSlice),
("testDeleteIfEmptyAfterArraySlice", testDeleteIfEmptyAfterArraySlice),
("testDeleteIfEmptyAfterDictionaryFilter", testDeleteIfEmptyAfterDictionaryFilter),
("testDeleteIfEmpty", testDeleteIfEmpty),
("testDeleteIfEmptyArraySlice", testDeleteIfEmptyArraySlice),
("testDeleteKey", testDeleteKey),
("testDeleteLastElement_ThrowsIfEmpty", testDeleteLastElement_ThrowsIfEmpty),
("testDeleteSlice", testDeleteSlice),
("testDeleteSliceFilter", testDeleteSliceFilter),
("testDeleteSliceIndex", testDeleteSliceIndex),
("testDeleteSliceKey", testDeleteSliceKey),
("testDeleteSliceSlice", testDeleteSliceSlice),
("testExplore", testExplore),
("testFolded", testFolded),
("testGetArraySlice", testGetArraySlice),
("testGetArraySliceArraySlice", testGetArraySliceArraySlice),
("testGetArraySliceCount", testGetArraySliceCount),
("testGetArraySliceDictionaryFilter", testGetArraySliceDictionaryFilter),
("testGetArraySliceIndex", testGetArraySliceIndex),
("testGetArraySliceKey", testGetArraySliceKey),
("testGetCount_ThrowsErrorIfNotFinal", testGetCount_ThrowsErrorIfNotFinal),
("testGetCount", testGetCount),
("testGetDictAndValue_ThrowsIfKeyHasTypoMiswrote", testGetDictAndValue_ThrowsIfKeyHasTypoMiswrote),
("testGetDictAndValue_ThrowsIfKeyNotExists", testGetDictAndValue_ThrowsIfKeyNotExists),
("testGetDictionaryCount", testGetDictionaryCount),
("testGetDictionaryFilter", testGetDictionaryFilter),
("testGetDictionaryFilterArraySlice", testGetDictionaryFilterArraySlice),
("testGetDictionaryFilterDictionaryFilter", testGetDictionaryFilterDictionaryFilter),
("testGetDictionaryFilterIndex", testGetDictionaryFilterIndex),
("testGetDictionaryFilterKey", testGetDictionaryFilterKey),
("testGetKeysListDict", testGetKeysListDict),
("testGetKeysListSubDict", testGetKeysListSubDict),
("testInit", testInit),
("testSet_ThrowsIfPathElementIsDictionaryOrArray", testSet_ThrowsIfPathElementIsDictionaryOrArray),
("testSetCount_ThrowsError", testSetCount_ThrowsError),
("testSetKey_ThrowsIfNotDictionary", testSetKey_ThrowsIfNotDictionary),
("testSetKeyName", testSetKeyName),
("testSetKeyNameCount_ThrowsError", testSetKeyNameCount_ThrowsError),
("testSubscriptArray_ThrowsIfNotArray", testSubscriptArray_ThrowsIfNotArray),
("testSubscriptArray_ThrowsIfWrongIndex", testSubscriptArray_ThrowsIfWrongIndex),
("testSubscriptArray", testSubscriptArray),
("testSubscriptArraySet", testSubscriptArraySet),
("testSubscriptDict_ThrowsIfNotDict", testSubscriptDict_ThrowsIfNotDict),
("testSubscriptDict", testSubscriptDict),
("testSubscriptDictSet", testSubscriptDictSet),
("testSubscriptWithArray", testSubscriptWithArray),
("testSubscriptWithArraySet", testSubscriptWithArraySet)
]
}
extension PathExplorerTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PathExplorerTests = [
("testConvertAutomaticBool", testConvertAutomaticBool),
("testConvertAutomaticInt", testConvertAutomaticInt),
("testConvertAutomaticReal", testConvertAutomaticReal),
("testConvertAutomaticString", testConvertAutomaticString),
("testConvertBoolAutomaticBool", testConvertBoolAutomaticBool),
("testConvertBoolToBool", testConvertBoolToBool),
("testConvertIntAutomaticInt", testConvertIntAutomaticInt),
("testConvertIntToInt", testConvertIntToInt),
("testConvertRealAutomaticReal", testConvertRealAutomaticReal),
("testConvertRealToReal", testConvertRealToReal),
("testConvertStringToBool", testConvertStringToBool),
("testConvertStringToInt", testConvertStringToInt),
("testConvertStringToReal", testConvertStringToReal)
]
}
extension PathExplorerTestsIntegration {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PathExplorerTestsIntegration = [
("testAddArrayIndex", testAddArrayIndex),
("testAddArrayLastIndex", testAddArrayLastIndex),
("testAddDictKey", testAddDictKey),
("testAddNestedArrayInArray", testAddNestedArrayInArray),
("testAddNestedArrayIndex", testAddNestedArrayIndex),
("testAddNestedArrayLastIndex", testAddNestedArrayLastIndex),
("testAddNestedArrayTwoLevels", testAddNestedArrayTwoLevels),
("testAddNewArray", testAddNewArray),
("testAddNewArrayLast", testAddNewArrayLast),
("testAddNewDict", testAddNewDict),
("testAddNewDictAndArray", testAddNewDictAndArray),
("testDeleteArray", testDeleteArray),
("testDeleteArrayIndex", testDeleteArrayIndex),
("testDeleteArrayLastIndex", testDeleteArrayLastIndex),
("testDeleteDict", testDeleteDict),
("testDeleteDictKey", testDeleteDictKey),
("testDeleteNestedArrayInArrayIndex", testDeleteNestedArrayInArrayIndex),
("testDeleteNestedArrayIndex", testDeleteNestedArrayIndex),
("testDeleteNestedArrayLastIndex", testDeleteNestedArrayLastIndex),
("testGetArrayIndex", testGetArrayIndex),
("testGetArrayLastIndex", testGetArrayLastIndex),
("testGetDictKey", testGetDictKey),
("testGetNestedArrayInArrayIndex", testGetNestedArrayInArrayIndex),
("testGetNestedArrayIndex", testGetNestedArrayIndex),
("testGetNestedArrayLastIndex", testGetNestedArrayLastIndex),
("testSetArrayIndex", testSetArrayIndex),
("testSetArrayLastIndex", testSetArrayLastIndex),
("testSetDictKey", testSetDictKey),
("testSetNestedArrayInArrayIndex", testSetNestedArrayInArrayIndex),
("testSetNestedArrayIndex", testSetNestedArrayIndex),
("testSetNestedArrayLastIndex", testSetNestedArrayLastIndex)
]
}
extension PathExplorerXMLTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PathExplorerXMLTests = [
("testAddCount_ThrowsError", testAddCount_ThrowsError),
("testAddKey1", testAddKey1),
("testAddKey2", testAddKey2),
("testAddKey3", testAddKey3),
("testAddKeyArray", testAddKeyArray),
("testAddKeyArrayInsert", testAddKeyArrayInsert),
("testAddKeyDict", testAddKeyDict),
("testDelete", testDelete),
("testDeleteCount_ThrowsError", testDeleteCount_ThrowsError),
("testDeleteDictionaryFilter", testDeleteDictionaryFilter),
("testDeleteDictionaryFilterIndex", testDeleteDictionaryFilterIndex),
("testDeleteDictionaryFilterKey", testDeleteDictionaryFilterKey),
("testDeleteIfEmpty", testDeleteIfEmpty),
("testDeleteSlice", testDeleteSlice),
("testDeleteSliceIndex", testDeleteSliceIndex),
("testDeleteSliceKey", testDeleteSliceKey),
("testExplore", testExplore),
("testExportCSVArray", testExportCSVArray),
("testExportCSVArrayOfArrays", testExportCSVArrayOfArrays),
("testExportCSVDictionaryOfArrays", testExportCSVDictionaryOfArrays),
("testExportCSVHeadersAndValues", testExportCSVHeadersAndValues),
("testFolded", testFolded),
("testGetArraySlice", testGetArraySlice),
("testGetArraySliceIndex", testGetArraySliceIndex),
("testGetArraySliceKey", testGetArraySliceKey),
("testGetCount_ThrowsErrorIfNotFinal", testGetCount_ThrowsErrorIfNotFinal),
("testGetCount", testGetCount),
("testGetCountDictionaryFilter", testGetCountDictionaryFilter),
("testGetDictionaryFilter", testGetDictionaryFilter),
("testGetDictionaryFilterIndex", testGetDictionaryFilterIndex),
("testGetDictionaryFilterKey", testGetDictionaryFilterKey),
("testGetFilterGroupSample", testGetFilterGroupSample),
("testGetKeysListDict", testGetKeysListDict),
("testGetKeysListSubDict", testGetKeysListSubDict),
("testGetSliceCount", testGetSliceCount),
("testGetSliceGroupSample", testGetSliceGroupSample),
("testInitNotThrows", testInitNotThrows),
("testSetCount_ThrowsError", testSetCount_ThrowsError),
("testSetKeyName", testSetKeyName),
("testSetKeyNameCount_ThrowsError", testSetKeyNameCount_ThrowsError),
("testSubscriptArray", testSubscriptArray),
("testSubscriptArraySet", testSubscriptArraySet),
("testSubscriptInt", testSubscriptInt),
("testSubscriptIntSet", testSubscriptIntSet),
("testSubscriptString", testSubscriptString),
("testSubscriptStringSet", testSubscriptStringSet)
]
}
extension PathTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PathTests = [
("testCount", testCount),
("testCountNotFinal", testCountNotFinal),
("testEqual", testEqual),
("testFilterAndCount", testFilterAndCount),
("testFilter", testFilter),
("testFullSlice", testFullSlice),
("testKeysListAfterIndex", testKeysListAfterIndex),
("testKeysList", testKeysList),
("testKeysListFirstElement", testKeysListFirstElement),
("testKeysWithBracketsAndIndex", testKeysWithBracketsAndIndex),
("testKeysWithBrackets", testKeysWithBrackets),
("testKeysWithIndex", testKeysWithIndex),
("testKeysWithNegativeIndex", testKeysWithNegativeIndex),
("testNestedArray", testNestedArray),
("testNestedArrayTwoLevels", testNestedArrayTwoLevels),
("testPartialSliceLeft", testPartialSliceLeft),
("testPartialSliceRight", testPartialSliceRight),
("testRootElementArray", testRootElementArray),
("testRootElementNestedArrays", testRootElementNestedArrays),
("testSeparator1", testSeparator1),
("testSeparator2", testSeparator2),
("testSeparator3", testSeparator3),
("testSeparator3WithBracketAndIndex", testSeparator3WithBracketAndIndex),
("testSimpleKeys", testSimpleKeys)
]
}
extension StringExtensionsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__StringExtensionsTests = [
("testEscape1", testEscape1)
]
}
extension String_JaroWinklerTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__String_JaroWinklerTests = [
("testBestMatch", testBestMatch),
("testDIXON", testDIXON),
("testDWAYNE", testDWAYNE),
("testMartha", testMartha)
]
}
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(ArrayExtensionsTests.__allTests__ArrayExtensionsTests),
testCase(BoundsTests.__allTests__BoundsTests),
testCase(KeyTypeTests.__allTests__KeyTypeTests),
testCase(NSRegularExpressionExtensionsTests.__allTests__NSRegularExpressionExtensionsTests),
testCase(PathExplorerSerializationTests.__allTests__PathExplorerSerializationTests),
testCase(PathExplorerTests.__allTests__PathExplorerTests),
testCase(PathExplorerTestsIntegration.__allTests__PathExplorerTestsIntegration),
testCase(PathExplorerXMLTests.__allTests__PathExplorerXMLTests),
testCase(PathTests.__allTests__PathTests),
testCase(StringExtensionsTests.__allTests__StringExtensionsTests),
testCase(String_JaroWinklerTests.__allTests__String_JaroWinklerTests)
]
}
#endif