Skip to content

Commit 034ff69

Browse files
committed
Dictionary tests (tip)
1 parent 7ef972c commit 034ff69

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Tests/Dictionary.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import RemObjects.Elements.EUnit
2+
3+
public class DictionaryTests : Test {
4+
5+
public func test82211() {
6+
7+
var dict = [String: String]()
8+
dict["test"] = "someString"
9+
10+
writeLn("dict[\"test\"] \(dict["test"])")
11+
12+
Check.AreEqual(dict["test"], "someString") // good
13+
Check.IsNotNil(dict["test"]) // good
14+
Check.IsTrue(assigned(dict["test"])) // fails
15+
Check.IsTrue(dict["test"] != nil) // fails
16+
writeLn("dict[\"test\"] != nil \(dict["test"] != nil)") // False
17+
writeLn("dict[\"test\"] == nil \(dict["test"] == nil)") // True
18+
19+
let hasValue: Bool = dict["test"] != nil
20+
writeLn("hasValue \(hasValue)")
21+
if !hasValue {
22+
throw Exception("dict[test] is not nil!")
23+
}
24+
}
25+
}

Tests/Swift.Tests.elements

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
<ItemGroup>
147147
<Compile Include="Program.swift" />
148148
<Compile Include="Range.swift" />
149+
<Compile Include="Dictionary.swift" />
149150
</ItemGroup>
150151
<Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Elements\RemObjects.Elements.targets" />
151152
<Import Project="..\Source\Swift.Shared.projitems" Label="Shared" />

0 commit comments

Comments
 (0)