Skip to content

Conversation

@rmonnet
Copy link
Contributor

@rmonnet rmonnet commented Jan 17, 2026

The generic 'expect_slices_match()' routine use the '%v' format, when applied to string with unicode, this displays the code points rather than the unicode characters.

For example, the test 'test_handles_case_of_greek_letters' display the expected result as
'["\u0392\u0393\u0391", "\u03b3\u03b2\u03b1"].
I modified the 'expect_slices_match()' procedure to use strings and '%s' instead and now the expected result looks like '[ΒΓΑ, γβα]'.

[no important files changed]

The generic 'expect_slices_match()' routine use the '%v' format,
when applied to string with unicode, this displays the code
points rather than the unicode characters.

For example, the test 'test_handles_case_of_greek_letters'
display the expected result as
'["\u0392\u0393\u0391", "\u03b3\u03b2\u03b1"].
I modified the 'expect_slices_match()' procedure to use
strings and '%s' instead and now the expected result looks like
'[ΒΓΑ, γβα]'.
@rmonnet rmonnet requested a review from glennj January 17, 2026 14:24
@rmonnet rmonnet added x:action/improve Improve existing functionality/content x:type/content Work on content (e.g. exercises, concepts) labels Jan 17, 2026
@github-actions
Copy link

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@rmonnet rmonnet changed the title Make sure the tests displays unicode characters properly Make sure the tests displays unicode characters properly [no important files changed] Jan 17, 2026
@glennj
Copy link
Contributor

glennj commented Jan 17, 2026

2 things:

  1. can you please make a note in dev/docs/faqs/when_writing_tests_how_to_compare_result_and_expected_for_slices.md -- it's good to keep a central library for these custom testing functions and the dev docs is as good a place as any.

  2. the "no important files changed" message goes into the merge message. The merge message becones the commit message for main's HEAD, and whatever backend process Exercism uses looks there to decide whether to retest all submissions. Since the track isn't even launched, there's not much overhead to test them all.

I modified the description in the When Writing Tests How to
Compare Resylt and Expected for Slice FAQ and created
the expect_helpers.odin template to provide an official
version of the comparison function for string slices and
general slices.
@rmonnet
Copy link
Contributor Author

rmonnet commented Jan 17, 2026

Good point! I included a new template file with the expect_slices() and expect_string_slices() procedures for developers to copy directly and modified the When Testing How to Compare Result and Expected for Slices FAQ accordingly.

@rmonnet rmonnet merged commit 8d0ea0e into exercism:main Jan 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:action/improve Improve existing functionality/content x:type/content Work on content (e.g. exercises, concepts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants