The same solution works via UI but fails tests when uploaded via exercism CLI


Here is my solution for Acronym in Bash on Exercism

#!/usr/bin/env bash

function acronym() {
  local acronym=""

  phrase="${1//[^a-zA-Z\']/ }"
  for word in $phrase; do

  echo "${acronym^^}"

acronym "$@"

Bash version on my local:
GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin21.6.0)

The exact same solution works against all tests when I submit it via the online editor on Exercism portal.

But, all tests fail (empty output against all tests) when submitted via the exercism CLI:
exercism submit

Could you kindly help look into this?

Hello. The reason it fails is that the correct filename is but you have submitted a file called via the CLI.

So I suspect that either:

  • You ran exercism submit
  • You ran exercism submit acronym* (or similar)
  • You ran exercism submit and there is a bug

Could you try ensuring that the only file in your directory is and run exercism submit pls? If that works, then we can try and work out which of the above was the root problem. Thanks.

(CC @glennj on the off-chance this is a bash thing and @ErikSchierboom from a CLI perspective)

(You can also step through the iterations at anjali-sharma's solution for Acronym in Bash on Exercism and see the tabs at the top to demonstrate what I mean)

you’re right. I used a different filename for the new iteration. I assumed exercism submit should work as expected.

Submitting with the expected filename works.
thanks a lot!

The filename is hardcoded in the test script.

I think the confusion occurred because running the test suite locally across any file path works as expected. Might be nice to include it as help text.

I don’t understand what that means. What is “any file path”?

If you had locally both (which passed the tests) and (which failed), then if you submitted only, then the remote test runner would fail.

As Glenn said, the filename is hard coded into the test script. See, for instance, this line. run bash 'Portable Network Graphics'. It does not work with other filenames.

Yeah, got it. I had both and as two approaches to the problem and both passed against the tests locally. I missed the hardcoded filename when submitting the solution. Thanks for the support everyone.

1 Like