re: #779
"random birthdates -> generate requested number of birthdates" test doesn't account for spaces in wc output
✗ random birthdates -> generate requested number of birthdates
(from function `assert_equal' in file bats-extra.bash, line 181,
in test file baffling_birthdays.bats, line 98)
`assert_equal "$num_output_dates" "$generate"' failed
-- values do not equal --
expected : 500
actual : 500
--
Change
num_output_dates=$( wc -w <<< "$output" )
to
num_output_dates=$( wc -w <<< "$output" | tr -d '[:space:]' )
NOTE this failed locally but not online; might be a Mac thing.
"random birthdates -> months are random" and "random birthdates -> days are random" require space separated output
I output one birthdate per line, seems natural
✗ random birthdates -> months are random
(from function `assert_equal' in file bats-extra.bash, line 181,
in test file baffling_birthdays.bats, line 129)
`assert_equal "${#seen_month[@]}" 12' failed
-- values do not equal --
expected : 12
actual : 1
--
✗ random birthdates -> days are random
(from function `assert_equal' in file bats-extra.bash, line 181,
in test file baffling_birthdays.bats, line 144)
`assert_equal "${#seen_day[@]}" 31' failed
-- values do not equal --
expected : 31
actual : 1
--
The tests use read which stops at the first newline.
Change
read -ra output_dates <<< "$output"
to
read -d '' -ra output_dates <<< "$output" || true
# or
read -d '' -ra output_dates < <(printf '%s\0' "$output")
re: #779
"random birthdates -> generate requested number of birthdates" test doesn't account for spaces in
wcoutputChange
num_output_dates=$( wc -w <<< "$output" )to
num_output_dates=$( wc -w <<< "$output" | tr -d '[:space:]' )NOTE this failed locally but not online; might be a Mac thing.
"random birthdates -> months are random" and "random birthdates -> days are random" require space separated output
I output one birthdate per line, seems natural
The tests use
readwhich stops at the first newline.Change
to