aboutsummaryrefslogtreecommitdiff
path: root/immutable_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2019-03-06 18:37:20 -0700
committerBen Johnson <benbjohnson@yahoo.com>2019-03-06 18:37:20 -0700
commit6c9db58c76b31424276cb70595c5208aa6c015ae (patch)
treefdcdb01e938416a2de9aa1646844aa680324e5fb /immutable_test.go
parentMerge pull request #7 from benbjohnson/sorted-map-builder (diff)
downloadpds-6c9db58c76b31424276cb70595c5208aa6c015ae.tar.gz
pds-6c9db58c76b31424276cb70595c5208aa6c015ae.tar.xz
Add ListBuilder.Len()
This commit adds a method to check the current length of a list on a `ListBuilder`. This allows the length to be checked without marking the next builder change as immutable.
Diffstat (limited to 'immutable_test.go')
-rw-r--r--immutable_test.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/immutable_test.go b/immutable_test.go
index 9c3f548..c6dfc13 100644
--- a/immutable_test.go
+++ b/immutable_test.go
@@ -274,7 +274,9 @@ func (l *TList) Slice(start, end int) {
// Validate returns an error if the slice and List are different.
func (l *TList) Validate() error {
- if got, exp := len(l.std), l.im.Len(); got != exp {
+ if got, exp := l.im.Len(), len(l.std); got != exp {
+ return fmt.Errorf("Len()=%v, expected %d", got, exp)
+ } else if got, exp := l.builder.Len(), len(l.std); got != exp {
return fmt.Errorf("Len()=%v, expected %d", got, exp)
}