1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Test that modifications preserve keys.

This commit is contained in:
Rob Rix 2015-11-05 11:50:37 -05:00
parent 7276b42d6f
commit 318a9926a2

View File

@ -56,6 +56,10 @@ final class LocationTests: XCTestCase {
assert(term.explore().down?.modify(const(leafB)).right?.modify(const(leafA)).up?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ])))
}
func testModificationsPreserveKeys() {
assert(keyed.explore().down?.modify(const(leafA)).root.it, ==, Cofree(3, .Keyed([ "a": innerLeafA, "b": leafA ])))
}
func testDeepModificationsReplaceDeepSubtrees() {
assert(term.explore().down?.modify(const(leafB)).right?.modify(const(leafA)).right?.down?.modify(const(innerLeafA)).right?.modify(const(innerLeafB)).root.it, ==, Cofree(0, .Indexed([ leafB, leafA, Cofree(3, .Keyed([ "a": innerLeafB, "b": innerLeafA ])) ])))
}