I was doing the grep.sh exercise and noticed that (some of?) the tests for multiple files actually test against a single file. To confirm that, I created some dummy code to see the number of files in the
By the way, this is how I derived the parameters as per guidance on the exercise:
while getopts livxn flag; do case $flag in n) flags+=(-n) ;; l) flags+=(-l) ;; i) flags+=(-i) ;; v) flags+=(-v) ;; x) flags+=(-x) ;; ?) echo "Usage: PROGRAM [-a ARG1] [-b]"; exit 1 ;; esac done shift $((OPTIND - 1)) pattern="$1" files=( $2 )
✗ Multiple files, one match, no flags (from function `assert_output' in file bats-extra.bash, line 394, in test file grep.bats, line 226) `assert_output "$expected"' failed -- output differs -- expected (1 lines): iliad.txt:Of Atreus, Agamemnon, King of men. actual (5 lines): A pattern: Agamemnon files: iliad.txt filecount: 1 flags: argc: 4 --
Can anyone please have look if I missed something? Cheers.