Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -n test to reverse-string ? #711

Open
glennj opened this issue Nov 18, 2024 · 2 comments
Open

Add -n test to reverse-string ? #711

glennj opened this issue Nov 18, 2024 · 2 comments

Comments

@glennj
Copy link
Contributor

glennj commented Nov 18, 2024

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.

@IsaacG
Copy link
Member

IsaacG commented Nov 18, 2024

Printing -n is a fun challenge, but it's not especially relevant to this exercise. In theory, that could be tacked onto any other exercise that allows arbitrary strings as the output. I would suggest passing.

@kotp
Copy link
Member

kotp commented Nov 18, 2024

We could bring this up in an automated feedback, rather than driving it through tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants