Update Invoice tests to use the new blocks interface, and fix reverse blocks iteration indexing
Changelog-None Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -139,6 +139,15 @@ struct NdbBlockGroup: ~Copyable {
|
||||
rawTextContent: content
|
||||
)
|
||||
}
|
||||
|
||||
/// Parses the note contents on-demand from a specific text.
|
||||
static func parse(content: String) throws(NdbBlocksError) -> Self {
|
||||
guard let metadata = BlocksMetadata.parseContent(content: content) else { throw NdbBlocksError.parseError }
|
||||
return self.init(
|
||||
metadata: .pure(metadata),
|
||||
rawTextContent: content
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
enum MaybeTxn<T: ~Copyable>: ~Copyable {
|
||||
|
||||
@@ -38,7 +38,7 @@ struct NonCopyableLinkedList<T: ~Copyable>: ~Copyable {
|
||||
|
||||
/// Iterates over each item of the list in reverse, with enumeration support.
|
||||
func forEachItemReversed<Y, E: Error>(_ borrowingFunction: ((_ index: Int, _ item: borrowing T) throws(E) -> LoopCommand<Y>)) throws(E) -> Y? {
|
||||
var indexCounter = count
|
||||
var indexCounter = count - 1
|
||||
var cursor: Node? = self.tail
|
||||
|
||||
outerLoop: while let nextItem = cursor {
|
||||
|
||||
Reference in New Issue
Block a user