HiveMinds / HiveMinds/Productivity-setup

Remove duplicate functions from `test/helper.sh`.

Open
#2 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
3
Forks
4
PR merge metrics
No merged PRs in 30d

Description

When an actual test result and a list of allowed results is passed, they arrive at a function that checks if the actual result is in some position in the list of allowed results.
This position can be:

- At the head
- At the tail
- At any position (contains)

However, passing the actual test result is 1 argument, the list is the second argument.*Assumption:* one cannot pass 3 arguments to a bash function. If that assumption is valid, it is not possible to simply pass an additional argument that tells the receiving function which position should be checked. Hence I triplicated the receiving function and just call the right function directly. However that is a lot of duplicate code, which is undesirable.


Possible solutions are:



  1. Push the position argument in the first entry of the list and read it out and remove that first element from the list.

  2. Push the position argument in the list and loop over the list starting at the second element in the list.


Doing either would allow me to remove 2 functions and turn them into a single function.


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.