gavv / gavv/httpexpect

Support negative indexes in Array

Open
#461 3 comments 0 reactions 0 assignees View on GitHub
feature help wanted
Dominant language
Go
Stars
2.7k
Forks
241
PR merge metrics
No merged PRs in 30d

Description

Support negative indexes in:

- `Array.Value`
- `Array.HasValue`
- `Array.NotHasValue`

Semantics should be the same as in Python. This feature is useful when you want to check boundary values in the array beginning and end. It becomes especially useful with deprecation of First and Last methods.

Bound checks in corresponding methods should be updated. Currently we check and report `AssertInRange` with `Min = 0, Max = len-1`. Now it would be convenient to report this range only if index is `>= 0`, and to check and report `Min = -len, Max = -1` range if index is negative.

Unit tests and documentation comments for all 3 methods should be updated as well.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.