Hi, I’m having some trouble figuring out why my tests are failing in the CLI but passing when I submit them:
When I run shopping.jq ($ jq -f shopping.jq shopping-list.json) my output is:
“Ingredients for pancakes”
8
0.25
{
“buttermilk”: “regular milk”,
“melted butter”: “vegetable oil”,
“blueberries”: “chopped apple”
}
Then I run $ bats test-shopping.bats and my output is:
test-shopping.bats
✗ Show shopping list name
(from function `assert_line' in file bats-extra.bash, line 276,
in test file test-shopping.bats, line 9)
`assert_line --index 0 '"Ingredients for pancakes"'' failed
-- line differs --
index : 0
expected : "Ingredients for pancakes"
actual : "Ingredients for pancakes"
--
✗ Count the ingredients
(from function `assert_line' in file bats-extra.bash, line 276,
in test file test-shopping.bats, line 16)
`assert_line --index 1 '8'' failed
-- line differs --
index : 1
expected : 8
actual : 8
--
✗ Show how much sugar is needed
(from function `assert_line' in file bats-extra.bash, line 276,
in test file test-shopping.bats, line 23)
`assert_line --index 2 '0.25'' failed
-- line differs --
index : 2
expected : 0.25
actual : 0.25
--
✓ Map of substitutions
4 tests, 3 failures
I don’t know why they’d fail if the “actual” values match the “expected” values.
When I submit my solution (exercism submit shopping.jq) it passes.