Skip to content

Commit bdcf640

Browse files
committed
Updated tests for Dictionary.keys/values
1 parent 44b12db commit bdcf640

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

validation-test/stdlib/HashedCollectionFilter3.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,19 @@ FilterTestSuite.test("Set.filter(_:) -> [Element]") {
1717
expectTrue(f is [Int])
1818
}
1919

20+
FilterTestSuite.test("Dictionary.keys -> LazyMapCollection") {
21+
let d = [10: 1010, 20: 1020, 30: 1030, 40: 1040]
22+
// .keys should produce a LazyMapCollection in Swift 3
23+
let f: Any = d.keys
24+
expectEqual(4, f.count)
25+
}
26+
27+
FilterTestSuite.test("Dictionary.values -> LazyMapCollection") {
28+
let d = [10: 1010, 20: 1020, 30: 1030, 40: 1040]
29+
// .values should produce a LazyMapCollection in Swift 3
30+
let f: Any = d.values
31+
expectEqual(4, f.count)
32+
}
33+
2034
runAllTests()
2135

validation-test/stdlib/HashedCollectionFilter4.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,19 @@ FilterTestSuite.test("Set.filter(_:) -> [Element] available") {
3737
expectEqual(2, f.count)
3838
}
3939

40+
FilterTestSuite.test("Dictionary.keys -> Keys") {
41+
let d = [10: 1010, 20: 1020, 30: 1030, 40: 1040]
42+
// .keys should produce a Dictionary.Keys in Swift 4
43+
let f: Any = d.keys
44+
expectTrue(f is Dictionary<Int, Int>.Keys)
45+
}
46+
47+
FilterTestSuite.test("Dictionary.values -> Values") {
48+
let d = [10: 1010, 20: 1020, 30: 1030, 40: 1040]
49+
// .values should produce a Dictionary.Values in Swift 4
50+
let f: Any = d.values
51+
expectTrue(f is Dictionary<Int, Int>.Values)
52+
}
53+
4054
runAllTests()
4155

0 commit comments

Comments
 (0)