mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Rename up
to outOf
.
This commit is contained in:
parent
825eaa5ac3
commit
ba450bf45a
@ -24,7 +24,7 @@ public struct Location<A>: SequenceType {
|
||||
|
||||
public var into: Location? { return _into(it) }
|
||||
|
||||
public var up: Location? { return _up(it) }
|
||||
public var outOf: Location? { return _up(it) }
|
||||
|
||||
public var left: Location? { return _left(it) }
|
||||
|
||||
@ -32,7 +32,7 @@ public struct Location<A>: SequenceType {
|
||||
|
||||
/// The root `Location` in the current exploration.
|
||||
public var root: Location {
|
||||
return up?.root ?? self
|
||||
return outOf?.root ?? self
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ public struct Location<A>: SequenceType {
|
||||
|
||||
/// Returns the logically next `Location` after the receiver and its children in a pre-order depth-first traversal.
|
||||
private var nextAfter: Location? {
|
||||
return right ?? up?.nextAfter
|
||||
return right ?? outOf?.nextAfter
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ final class LocationTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testCannotMoveUpwardsAtTheStartOfAnExploration() {
|
||||
assert(term.explore().up?.it, ==, nil)
|
||||
assert(term.explore().outOf?.it, ==, nil)
|
||||
}
|
||||
|
||||
func testCannotMoveSidewaysAtTheStartOfAnExploration() {
|
||||
@ -21,7 +21,7 @@ final class LocationTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testCanMoveBackUpwards() {
|
||||
assert(term.explore().into?.up?.it, ==, term)
|
||||
assert(term.explore().into?.outOf?.it, ==, term)
|
||||
}
|
||||
|
||||
func testCannotMoveLeftwardsFromFirstChildOfBranch() {
|
||||
@ -37,7 +37,7 @@ final class LocationTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testCanMoveBackUpwardsFromDeepExplorations() {
|
||||
assert(term.explore().into?.right?.right?.into?.right?.up?.up?.it, ==, term)
|
||||
assert(term.explore().into?.right?.right?.into?.right?.outOf?.outOf?.it, ==, term)
|
||||
}
|
||||
|
||||
func testCanReturnToStartOfExplorationFromArbitrarilyDeepNodes() {
|
||||
@ -49,11 +49,11 @@ final class LocationTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testModifyReplacesSubtrees() {
|
||||
assert(term.explore().into?.modify(const(leafB)).right?.up?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ])))
|
||||
assert(term.explore().into?.modify(const(leafB)).right?.outOf?.it, ==, Cofree(0, .Indexed([ leafB, leafB, keyed ])))
|
||||
}
|
||||
|
||||
func testMultipleModificationsReplaceMultipleSubtrees() {
|
||||
assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).up?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ])))
|
||||
assert(term.explore().into?.modify(const(leafB)).right?.modify(const(leafA)).outOf?.it, ==, Cofree(0, .Indexed([ leafB, leafA, keyed ])))
|
||||
}
|
||||
|
||||
func testModificationsPreserveKeys() {
|
||||
|
Loading…
Reference in New Issue
Block a user