Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add `-n` test to reverse-string ?

Open
#711 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
bash
Domain
testing-qa

Research direction

Locate the reverse-string exercise's existing test file and review how skipped tests and BATS_RUN_SKIPPED are handled. Add the proposed echo -n case only if the exercise's maintainers approve the difficulty change, then run the exercise tests and verify that n- produces -n successfully.

Written by the indexing model from the issue text.

Description

Given that the builtin echo command cannot output the string "-n" (ref Why is printf better than echo?), we could amp up the difficulty of reverse-string by adding another diabolical test:

@test "echo -n" {
  [[ $BATS_RUN_SKIPPED == "true" ]] || skip
  run bash reverse_string.sh 'n-'

  assert_success
  assert_output -- '-n'
}

This will force the student to learn about a fairly nasty echo edge case.

On the other hand, reverse-string is currently an easy exercise with difficulty 1, and adding this test is likely to break a large proportion of existing solutions.

Dominant language
Shell
Stars
117
Forks
99
Avg merge
1d 21h
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from exercism/bash

All issues in exercism/bash

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.