Update validation testsuite for the argument label default changes.

Swift SVN r27706
This commit is contained in:
Doug Gregor
2015-04-24 20:31:43 +00:00
parent 5b767efe72
commit 0523a09560
13 changed files with 97 additions and 95 deletions

View File

@@ -42,9 +42,9 @@ func isNativeNSArray(d: NSArray) -> Bool {
// Compare two arrays as sets.
func equalsUnordered<T : Comparable>(
lhs: Array<(T, T)>, rhs: Array<(T, T)>
lhs: Array<(T, T)>, _ rhs: Array<(T, T)>
) -> Bool {
func comparePair(lhs: (T, T), rhs: (T, T)) -> Bool {
func comparePair(lhs: (T, T), _ rhs: (T, T)) -> Bool {
return lexicographicalCompare([ lhs.0, lhs.1 ], [ rhs.0, rhs.1 ])
}
return equal(sorted(lhs, comparePair), sorted(rhs, comparePair)) {
@@ -53,7 +53,7 @@ func equalsUnordered<T : Comparable>(
}
}
func equalsUnordered<T : Comparable>(lhs: [T], rhs: [T]) -> Bool {
func equalsUnordered<T : Comparable>(lhs: [T], _ rhs: [T]) -> Bool {
return equal(sorted(lhs), sorted(rhs))
}
@@ -523,7 +523,7 @@ func == (lhs: TestBridgedEquatableValueTy, rhs: TestBridgedEquatableValueTy) ->
///
/// FIXME: Some non-zero `opt` might be cases of missed return-autorelease.
func expectAutoreleasedKeysAndValues(
opt: (Int, Int) = (0, 0), unopt: (Int, Int) = (0, 0)) {
#opt: (Int, Int) = (0, 0), unopt: (Int, Int) = (0, 0)) {
var expectedKeys = 0
var expectedValues = 0
#if arch(i386)
@@ -545,7 +545,7 @@ func expectAutoreleasedKeysAndValues(
///
/// FIXME: Some non-zero `opt` might be cases of missed return-autorelease.
func expectAutoreleasedValues(
opt: Int = 0, unopt: Int = 0) {
#opt: Int = 0, unopt: Int = 0) {
expectAutoreleasedKeysAndValues(opt: (0, opt), unopt: (0, unopt))
}
@@ -601,7 +601,7 @@ func getBridgedEmptyNSDictionary() -> NSDictionary {
}
func getBridgedNSDictionaryOfKeyValue_ValueTypesCustomBridged(
numElements: Int = 3
#numElements: Int = 3
) -> NSDictionary {
assert(!_isBridgedVerbatimToObjectiveC(TestBridgedKeyTy.self))
assert(!_isBridgedVerbatimToObjectiveC(TestBridgedValueTy.self))
@@ -620,7 +620,7 @@ func getBridgedNSDictionaryOfKeyValue_ValueTypesCustomBridged(
func slurpFastEnumerationFromSwift<
S : SinkType where S.Element == AnyObject
>(
a: NSArray, fe: NSFastEnumeration, inout sink: S, maxItems: Int? = nil
a: NSArray, _ fe: NSFastEnumeration, inout _ sink: S, maxItems: Int? = nil
) {
var state = NSFastEnumerationState()
@@ -663,7 +663,8 @@ typealias AnyObjectTuple2 = (AnyObject, AnyObject)
func slurpFastEnumerationFromSwift<
S : SinkType where S.Element == AnyObjectTuple2
>(
d: NSDictionary, fe: NSFastEnumeration, inout sink: S, maxItems: Int? = nil
d: NSDictionary, _ fe: NSFastEnumeration, inout _ sink: S,
maxItems: Int? = nil
) {
var state = NSFastEnumerationState()
@@ -704,8 +705,8 @@ func slurpFastEnumerationFromSwift<
func slurpFastEnumerationOfNSEnumeratorFromSwift<
S : SinkType where S.Element == AnyObject
>(
a: NSArray, enumerator: NSEnumerator, inout sink: S,
#maxFastEnumerationItems: Int
a: NSArray, _ enumerator: NSEnumerator, inout _ sink: S,
maxFastEnumerationItems: Int
) {
slurpFastEnumerationFromSwift(
a, enumerator, &sink, maxItems: maxFastEnumerationItems)
@@ -717,8 +718,8 @@ func slurpFastEnumerationOfNSEnumeratorFromSwift<
func slurpFastEnumerationOfNSEnumeratorFromSwift<
S : SinkType where S.Element == AnyObjectTuple2
>(
d: NSDictionary, enumerator: NSEnumerator, inout sink: S,
#maxFastEnumerationItems: Int
d: NSDictionary, _ enumerator: NSEnumerator, inout _ sink: S,
maxFastEnumerationItems: Int
) {
slurpFastEnumerationFromSwift(
d, enumerator, &sink, maxItems: maxFastEnumerationItems)
@@ -734,7 +735,7 @@ import SlurpFastEnumeration
func slurpFastEnumerationFromObjC<
S : SinkType where S.Element == AnyObject
>(
a: NSArray, fe: NSFastEnumeration, inout sink: S
a: NSArray, _ fe: NSFastEnumeration, inout _ sink: S
) {
let objcValues = NSMutableArray()
slurpFastEnumerationOfArrayFromObjCImpl(a, fe, objcValues)
@@ -776,7 +777,7 @@ func < (
}
func _equalsWithoutElementIdentity(
lhs: [ExpectedArrayElement], rhs: [ExpectedArrayElement]
lhs: [ExpectedArrayElement], _ rhs: [ExpectedArrayElement]
) -> Bool {
func stripIdentity(
list: [ExpectedArrayElement]
@@ -799,10 +800,10 @@ func _makeExpectedArrayContents(
func _checkArrayFastEnumerationImpl(
expected: [Int],
a: NSArray,
makeEnumerator: () -> NSFastEnumeration,
useEnumerator: (NSArray, NSFastEnumeration, (AnyObject)->()) -> (),
convertValue: (AnyObject) -> Int
_ a: NSArray,
_ makeEnumerator: () -> NSFastEnumeration,
_ useEnumerator: (NSArray, NSFastEnumeration, (AnyObject)->()) -> (),
_ convertValue: (AnyObject) -> Int
) {
var expectedContentsWithoutIdentity =
_makeExpectedArrayContents(expected)
@@ -835,8 +836,8 @@ func _checkArrayFastEnumerationImpl(
func checkArrayFastEnumerationFromSwift(
expected: [Int],
a: NSArray, makeEnumerator: () -> NSFastEnumeration,
convertValue: (AnyObject) -> Int
_ a: NSArray, _ makeEnumerator: () -> NSFastEnumeration,
_ convertValue: (AnyObject) -> Int
) {
_checkArrayFastEnumerationImpl(
expected, a, makeEnumerator,
@@ -849,8 +850,8 @@ func checkArrayFastEnumerationFromSwift(
func checkArrayFastEnumerationFromObjC(
expected: [Int],
a: NSArray, makeEnumerator: () -> NSFastEnumeration,
convertValue: (AnyObject) -> Int
_ a: NSArray, _ makeEnumerator: () -> NSFastEnumeration,
_ convertValue: (AnyObject) -> Int
) {
_checkArrayFastEnumerationImpl(
expected, a, makeEnumerator,
@@ -863,9 +864,9 @@ func checkArrayFastEnumerationFromObjC(
func checkArrayEnumeratorPartialFastEnumerationFromSwift(
expected: [Int],
a: NSArray,
#maxFastEnumerationItems: Int,
convertValue: (AnyObject) -> Int
_ a: NSArray,
maxFastEnumerationItems: Int,
_ convertValue: (AnyObject) -> Int
) {
_checkArrayFastEnumerationImpl(
expected, a, { a.objectEnumerator() },
@@ -921,7 +922,7 @@ func _makeExpectedSetContents(
}
func _equalsUnorderedWithoutElementIdentity(
lhs: [ExpectedSetElement], rhs: [ExpectedSetElement]
lhs: [ExpectedSetElement], _ rhs: [ExpectedSetElement]
) -> Bool {
func stripIdentity(
list: [ExpectedSetElement]
@@ -934,10 +935,10 @@ func _equalsUnorderedWithoutElementIdentity(
func _checkSetFastEnumerationImpl(
expected: [Int],
s: NSSet,
makeEnumerator: () -> NSFastEnumeration,
useEnumerator: (NSSet, NSFastEnumeration, (AnyObject)->()) -> (),
convertMember: (AnyObject) -> Int
_ s: NSSet,
_ makeEnumerator: () -> NSFastEnumeration,
_ useEnumerator: (NSSet, NSFastEnumeration, (AnyObject)->()) -> (),
_ convertMember: (AnyObject) -> Int
) {
var expectedContentsWithoutIdentity =
_makeExpectedSetContents(expected)
@@ -970,7 +971,7 @@ func _checkSetFastEnumerationImpl(
func slurpFastEnumerationFromObjC<
S : SinkType where S.Element == AnyObject
>(
s: NSSet, fe: NSFastEnumeration, inout sink: S
s: NSSet, _ fe: NSFastEnumeration, inout _ sink: S
) {
let objcValues = NSMutableArray()
slurpFastEnumerationOfArrayFromObjCImpl(s, fe, objcValues)
@@ -982,8 +983,8 @@ func slurpFastEnumerationFromObjC<
func slurpFastEnumerationOfNSEnumeratorFromSwift<
S : SinkType where S.Element == AnyObject
>(
s: NSSet, enumerator: NSEnumerator, inout sink: S,
#maxFastEnumerationItems: Int
s: NSSet, _ enumerator: NSEnumerator, inout _ sink: S,
maxFastEnumerationItems: Int
) {
slurpFastEnumerationFromSwift(
s, enumerator, &sink, maxItems: maxFastEnumerationItems)
@@ -995,7 +996,7 @@ func slurpFastEnumerationOfNSEnumeratorFromSwift<
func slurpFastEnumerationFromSwift<
S : SinkType where S.Element == AnyObject
>(
s: NSSet, fe: NSFastEnumeration, inout sink: S, maxItems: Int? = nil
s: NSSet, _ fe: NSFastEnumeration, inout _ sink: S, maxItems: Int? = nil
) {
var state = NSFastEnumerationState()
@@ -1035,8 +1036,8 @@ func slurpFastEnumerationFromSwift<
func checkSetFastEnumerationFromSwift(
expected: [Int],
s: NSSet, makeEnumerator: () -> NSFastEnumeration,
convertMember: (AnyObject) -> Int
_ s: NSSet, _ makeEnumerator: () -> NSFastEnumeration,
_ convertMember: (AnyObject) -> Int
) {
_checkSetFastEnumerationImpl(
expected, s, makeEnumerator,
@@ -1049,8 +1050,8 @@ func checkSetFastEnumerationFromSwift(
func checkSetFastEnumerationFromObjC(
expected: [Int],
s: NSSet, makeEnumerator: () -> NSFastEnumeration,
convertMember: (AnyObject) -> Int
_ s: NSSet, _ makeEnumerator: () -> NSFastEnumeration,
_ convertMember: (AnyObject) -> Int
) {
_checkSetFastEnumerationImpl(
expected, s, makeEnumerator,
@@ -1063,9 +1064,9 @@ func checkSetFastEnumerationFromObjC(
func checkSetEnumeratorPartialFastEnumerationFromSwift(
expected: [Int],
s: NSSet,
#maxFastEnumerationItems: Int,
convertMember: (AnyObject) -> Int
_ s: NSSet,
maxFastEnumerationItems: Int,
_ convertMember: (AnyObject) -> Int
) {
_checkSetFastEnumerationImpl(
expected, s, { s.objectEnumerator() },
@@ -1082,7 +1083,7 @@ func checkSetEnumeratorPartialFastEnumerationFromSwift(
func slurpFastEnumerationFromObjC<
S : SinkType where S.Element == AnyObjectTuple2
>(
d: NSDictionary, fe: NSFastEnumeration, inout sink: S
d: NSDictionary, _ fe: NSFastEnumeration, inout _ sink: S
) {
let objcPairs = NSMutableArray()
slurpFastEnumerationOfDictionaryFromObjCImpl(d, fe, objcPairs)
@@ -1135,7 +1136,7 @@ func < (
}
func _equalsUnorderedWithoutElementIdentity(
lhs: [ExpectedDictionaryElement], rhs: [ExpectedDictionaryElement]
lhs: [ExpectedDictionaryElement], _ rhs: [ExpectedDictionaryElement]
) -> Bool {
func stripIdentity(
list: [ExpectedDictionaryElement]
@@ -1158,11 +1159,11 @@ func _makeExpectedDictionaryContents(
func _checkDictionaryFastEnumerationImpl(
expected: [(Int, Int)],
d: NSDictionary,
makeEnumerator: () -> NSFastEnumeration,
useEnumerator: (NSDictionary, NSFastEnumeration, (AnyObjectTuple2)->()) -> (),
convertKey: (AnyObject) -> Int,
convertValue: (AnyObject) -> Int
_ d: NSDictionary,
_ makeEnumerator: () -> NSFastEnumeration,
_ useEnumerator: (NSDictionary, NSFastEnumeration, (AnyObjectTuple2)->()) -> (),
_ convertKey: (AnyObject) -> Int,
_ convertValue: (AnyObject) -> Int
) {
var expectedContentsWithoutIdentity =
_makeExpectedDictionaryContents(expected)
@@ -1196,9 +1197,9 @@ func _checkDictionaryFastEnumerationImpl(
func checkDictionaryFastEnumerationFromSwift(
expected: [(Int, Int)],
d: NSDictionary, makeEnumerator: () -> NSFastEnumeration,
convertKey: (AnyObject) -> Int,
convertValue: (AnyObject) -> Int
_ d: NSDictionary, _ makeEnumerator: () -> NSFastEnumeration,
_ convertKey: (AnyObject) -> Int,
_ convertValue: (AnyObject) -> Int
) {
_checkDictionaryFastEnumerationImpl(
expected, d, makeEnumerator,
@@ -1211,9 +1212,9 @@ func checkDictionaryFastEnumerationFromSwift(
func checkDictionaryFastEnumerationFromObjC(
expected: [(Int, Int)],
d: NSDictionary, makeEnumerator: () -> NSFastEnumeration,
convertKey: (AnyObject) -> Int,
convertValue: (AnyObject) -> Int
_ d: NSDictionary, _ makeEnumerator: () -> NSFastEnumeration,
_ convertKey: (AnyObject) -> Int,
_ convertValue: (AnyObject) -> Int
) {
_checkDictionaryFastEnumerationImpl(
expected, d, makeEnumerator,
@@ -1226,10 +1227,10 @@ func checkDictionaryFastEnumerationFromObjC(
func checkDictionaryEnumeratorPartialFastEnumerationFromSwift(
expected: [(Int, Int)],
d: NSDictionary,
#maxFastEnumerationItems: Int,
convertKey: (AnyObject) -> Int,
convertValue: (AnyObject) -> Int
_ d: NSDictionary,
maxFastEnumerationItems: Int,
_ convertKey: (AnyObject) -> Int,
_ convertValue: (AnyObject) -> Int
) {
_checkDictionaryFastEnumerationImpl(
expected, d, { d.keyEnumerator() },
@@ -1243,7 +1244,7 @@ func checkDictionaryEnumeratorPartialFastEnumerationFromSwift(
}
func getBridgedNSArrayOfRefTypeVerbatimBridged(
numElements: Int = 3,
#numElements: Int = 3,
capacity: Int? = nil
) -> NSArray {
assert(_isBridgedVerbatimToObjectiveC(TestObjCValueTy.self))
@@ -1263,7 +1264,7 @@ func getBridgedNSArrayOfRefTypeVerbatimBridged(
}
func getBridgedNSArrayOfValueTypeCustomBridged(
numElements: Int = 3,
#numElements: Int = 3,
capacity: Int? = nil
) -> NSArray {
assert(!_isBridgedVerbatimToObjectiveC(TestBridgedValueTy.self))

View File

@@ -9,7 +9,7 @@ public func foo<
where
Expected.Generator.Element == Actual.Generator.Element,
Expected.Generator.Element == (T, T)
>(expected: Expected, actual: Actual) {}
>(expected: Expected, _ actual: Actual) {}
func f() {
foo(

View File

@@ -5,7 +5,7 @@
// http://www.openradar.me/18041799
// https://gist.github.com/stigi/336a9851cd80fdef22ed
func a(b: Int = 0) {
func a(#b: Int = 0) {
}
let c = a
c() // expected-error {{missing argument for parameter 'b' in call}}

View File

@@ -4,7 +4,7 @@
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
// https://gist.github.com/tenderlove/66ff6ae1feed92ac37f2
func a(x: Any, y: Any) -> (((Any, Any) -> Any) -> Any) {
func a(x: Any, _ y: Any) -> (((Any, Any) -> Any) -> Any) {
return {
(m: (Any, Any) -> Any) -> Any in
return m(x, y)

View File

@@ -6,7 +6,7 @@
protocol C {
static func c(o: AnyObject) -> Self?
}
func d<A,B>(a : A, f : A -> B) -> B {
func d<A,B>(a : A, _ f : A -> B) -> B {
} // expected-error {{missing return in a function expected to return 'B'}}
class D<A:C> {
func e(o: AnyObject) {

View File

@@ -919,7 +919,7 @@ DictionaryTestSuite.test("COW.Slow.EqualityTestDoesNotReallocate") {
// Native dictionary tests.
//===---
func helperDeleteThree(k1: TestKeyTy, k2: TestKeyTy, k3: TestKeyTy) {
func helperDeleteThree(k1: TestKeyTy, _ k2: TestKeyTy, _ k3: TestKeyTy) {
var d1 = Dictionary<TestKeyTy, TestValueTy>(minimumCapacity: 10)
d1[k1] = TestValueTy(1010)
@@ -2219,7 +2219,7 @@ DictionaryTestSuite.test("BridgedFromObjC.Nonverbatim.EqualityTest_Empty") {
DictionaryTestSuite.test("BridgedFromObjC.Verbatim.EqualityTest_Small") {
func helper(nd1: Dictionary<Int, Int>, nd2: Dictionary<Int, Int>, expectedEq: Bool) {
func helper(nd1: Dictionary<Int, Int>, _ nd2: Dictionary<Int, Int>, _ expectedEq: Bool) {
var d1 = getBridgedVerbatimEquatableDictionary(nd1)
var identity1 = unsafeBitCast(d1, Word.self)
assert(isCocoaDictionary(d1))

View File

@@ -111,7 +111,7 @@ func testMixedSignArithmetic() {
% end
}
func testOps<T : IntegerArithmeticType>(x: T, y: T) -> T {
func testOps<T : IntegerArithmeticType>(x: T, _ y: T) -> T {
let a = x + y
let s = x - y
let m = x * y

View File

@@ -6,7 +6,7 @@ import StdlibUnittest
var HashingTestSuite = TestSuite("Hashing")
func avalancheTest(bits: Int, hashUnderTest: (UInt64) -> UInt64, pValue: Double) {
func avalancheTest(bits: Int, _ hashUnderTest: (UInt64) -> UInt64, _ pValue: Double) {
let testsInBatch = 100000
let testData = randArray64(testsInBatch)
let testDataHashed = Array(lazy(testData).map { hashUnderTest($0) })

View File

@@ -31,7 +31,7 @@ SetTestSuite.tearDown {
expectNoLeaksOfDictionaryKeysValues()
}
func getCOWFastSet(_ members: [Int] = [1010, 2020, 3030]) -> Set<Int> {
func getCOWFastSet(members: [Int] = [1010, 2020, 3030]) -> Set<Int> {
var s = Set<Int>(minimumCapacity: 10)
for member in members {
s.insert(member)
@@ -40,7 +40,7 @@ func getCOWFastSet(_ members: [Int] = [1010, 2020, 3030]) -> Set<Int> {
return s
}
func getCOWSlowSet(_ members: [Int] = [1010, 2020, 3030]) -> Set<TestKeyTy> {
func getCOWSlowSet(members: [Int] = [1010, 2020, 3030]) -> Set<TestKeyTy> {
var s = Set<TestKeyTy>(minimumCapacity: 10)
for member in members {
s.insert(TestKeyTy(member))
@@ -49,7 +49,7 @@ func getCOWSlowSet(_ members: [Int] = [1010, 2020, 3030]) -> Set<TestKeyTy> {
return s
}
func helperDeleteThree(k1: TestKeyTy, k2: TestKeyTy, k3: TestKeyTy) {
func helperDeleteThree(k1: TestKeyTy, _ k2: TestKeyTy, _ k3: TestKeyTy) {
var s1 = Set<TestKeyTy>(minimumCapacity: 10)
s1.insert(k1)
@@ -114,14 +114,14 @@ func isCocoaSet<T : Hashable>(s: Set<T>) -> Bool {
return !isNativeSet(s)
}
func equalsUnordered(lhs: Set<Int>, rhs: Set<Int>) -> Bool {
func equalsUnordered(lhs: Set<Int>, _ rhs: Set<Int>) -> Bool {
return equal(sorted(lhs), sorted(rhs)) {
$0 == $1
}
}
/// Get an NSSet of TestObjCKeyTy values
func getAsNSSet(_ members: [Int] = [1010, 2020, 3030]) -> NSSet {
func getAsNSSet(members: [Int] = [1010, 2020, 3030]) -> NSSet {
let nsArray = NSMutableArray()
for member in members {
nsArray.addObject(TestObjCKeyTy(member))
@@ -130,7 +130,7 @@ func getAsNSSet(_ members: [Int] = [1010, 2020, 3030]) -> NSSet {
}
/// Get an NSMutableSet of TestObjCKeyTy values
func getAsNSMutableSet(_ members: [Int] = [1010, 2020, 3030]) -> NSMutableSet {
func getAsNSMutableSet(members: [Int] = [1010, 2020, 3030]) -> NSMutableSet {
let nsArray = NSMutableArray()
for member in members {
nsArray.addObject(TestObjCKeyTy(member))
@@ -139,7 +139,7 @@ func getAsNSMutableSet(_ members: [Int] = [1010, 2020, 3030]) -> NSMutableSet {
}
/// Get a Set<NSObject> (Set<TestObjCKeyTy>) backed by Cocoa storage
func getBridgedVerbatimSet(_ members: [Int] = [1010, 2020, 3030])
func getBridgedVerbatimSet(members: [Int] = [1010, 2020, 3030])
-> Set<NSObject> {
var nss = getAsNSSet(members)
let result: Set<NSObject> = _convertNSSetToSet(nss)
@@ -148,7 +148,7 @@ func getBridgedVerbatimSet(_ members: [Int] = [1010, 2020, 3030])
}
/// Get a Set<NSObject> (Set<TestObjCKeyTy>) backed by native storage
func getNativeBridgedVerbatimSet(_ members: [Int] = [1010, 2020, 3030]) ->
func getNativeBridgedVerbatimSet(members: [Int] = [1010, 2020, 3030]) ->
Set<NSObject> {
let result: Set<NSObject> = Set(members.map({ TestObjCKeyTy($0) }))
expectTrue(isNativeSet(result))
@@ -164,7 +164,7 @@ func getHugeBridgedVerbatimSet() -> Set<NSObject> {
}
/// Get a Set<TestBridgedKeyTy> backed by native storage
func getBridgedNonverbatimSet(_ members: [Int] = [1010, 2020, 3030]) ->
func getBridgedNonverbatimSet(members: [Int] = [1010, 2020, 3030]) ->
Set<TestBridgedKeyTy> {
var nss = getAsNSSet(members)
let identity1 = unsafeBitCast(nss, Word.self)
@@ -212,7 +212,7 @@ func getBridgedNSSetOfRefTypesBridgedVerbatim() -> NSSet {
}
func getBridgedNSSet_ValueTypesCustomBridged(
numElements: Int = 3
#numElements: Int = 3
) -> NSSet {
expectTrue(!_isBridgedVerbatimToObjectiveC(TestBridgedKeyTy.self))

View File

@@ -25,7 +25,7 @@ StringTests.test("sizeof") {
}
func checkUnicodeScalarViewIteration(
expectedScalars: [UInt32], str: String
expectedScalars: [UInt32], _ str: String
) {
if true {
var us = str.unicodeScalars

View File

@@ -122,8 +122,8 @@ struct ArraySinkOf<T> : SinkType {
}
func checkDecodeUTF<Codec : UnicodeCodecType>(
codec: Codec.Type, expectedHead: [UInt32],
expectedRepairedTail: [UInt32], utfStr: [Codec.CodeUnit]
codec: Codec.Type, _ expectedHead: [UInt32],
_ expectedRepairedTail: [UInt32], _ utfStr: [Codec.CodeUnit]
) -> AssertionResult {
if true {
var decoded = ArraySinkOf<UInt32>()
@@ -159,14 +159,14 @@ func checkDecodeUTF<Codec : UnicodeCodecType>(
func checkDecodeUTF8(
expectedHead: [UInt32],
expectedRepairedTail: [UInt32], utf8Str: [UInt8]
_ expectedRepairedTail: [UInt32], _ utf8Str: [UInt8]
) -> AssertionResult {
return checkDecodeUTF(UTF8.self, expectedHead, expectedRepairedTail, utf8Str)
}
func checkDecodeUTF16(
expectedHead: [UInt32],
expectedRepairedTail: [UInt32], utf16Str: [UInt16]
_ expectedRepairedTail: [UInt32], _ utf16Str: [UInt16]
) -> AssertionResult {
return checkDecodeUTF(UTF16.self, expectedHead, expectedRepairedTail,
utf16Str)
@@ -174,13 +174,14 @@ func checkDecodeUTF16(
func checkDecodeUTF32(
expectedHead: [UInt32],
expectedRepairedTail: [UInt32], utf32Str: [UInt32]
_ expectedRepairedTail: [UInt32], _ utf32Str: [UInt32]
) -> AssertionResult {
return checkDecodeUTF(UTF32.self, expectedHead, expectedRepairedTail,
utf32Str)
}
func checkEncodeUTF8(expected: [UInt8], scalars: [UInt32]) -> AssertionResult {
func checkEncodeUTF8(expected: [UInt8],
_ scalars: [UInt32]) -> AssertionResult {
var encoded = ArraySinkOf<UInt8>()
var g = EOFCountingGenerator(scalars)
let hadError =
@@ -2166,15 +2167,15 @@ class NonContiguousNSString : NSString {
var _value: [UInt16]
}
func checkUTF8View(expected: [UInt8], subject: String,
stackTrace: SourceLocStack) {
func checkUTF8View(expected: [UInt8], _ subject: String,
_ stackTrace: SourceLocStack) {
checkForwardCollection(
expected, subject.utf8,
stackTrace.withCurrentLoc())
}
func checkUTF16View(expected: [UInt16], subject: String,
stackTrace: SourceLocStack) {
func checkUTF16View(expected: [UInt16], _ subject: String,
_ stackTrace: SourceLocStack) {
checkSliceableWithBidirectionalIndex(expected, subject.utf16,
stackTrace.withCurrentLoc())
}

View File

@@ -132,7 +132,7 @@ class NonContiguousNSString : NSString {
/// Verify that extended grapheme cluster boundaries in `subject` occur at
/// positions specified in `expectedBoundaries`.
func checkGraphemeClusterSegmentation(
expectedBoundaries: [Int], subject: String, stackTrace: SourceLocStack
expectedBoundaries: [Int], _ subject: String, _ stackTrace: SourceLocStack
) {
var actualBoundaries: [Int] = [ 0 ]
var unicodeScalarCount = 0
@@ -152,7 +152,7 @@ func checkGraphemeClusterSegmentation(
}
func checkGraphemeClusterSegmentation(
expectedBoundaries: [Int], #scalars: [UInt32], stackTrace: SourceLocStack
expectedBoundaries: [Int], scalars: [UInt32], _ stackTrace: SourceLocStack
) {
let subject = NonContiguousNSString(scalars) as String
checkGraphemeClusterSegmentation(expectedBoundaries, subject,
@@ -160,7 +160,7 @@ func checkGraphemeClusterSegmentation(
}
func checkGraphemeClusterSegmentation(
expectedBoundaries: [Int], #codeUnits: [UInt16], stackTrace: SourceLocStack
expectedBoundaries: [Int], codeUnits: [UInt16], _ stackTrace: SourceLocStack
) {
let subject = NonContiguousNSString(codeUnits) as String
checkGraphemeClusterSegmentation(expectedBoundaries, subject,

View File

@@ -68,9 +68,9 @@ func nthUnicodeScalar(n: UInt32) -> UnicodeScalar {
// `buffer` should have a length >= 4
func nsEncode<CodeUnit>(
var c: UInt32,
encoding: NSStringEncoding,
inout buffer: [CodeUnit],
inout used: Int
_ encoding: NSStringEncoding,
inout _ buffer: [CodeUnit],
inout _ used: Int
) {
_precondition(buffer.count >= 4, "buffer is not large enough")