Skip to content

Commit

Permalink
Add test to ensure multibyte chars work with the usage substring
Browse files Browse the repository at this point in the history
  • Loading branch information
andsens committed May 10, 2024
1 parent de0e266 commit 241fb7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/scripts/multibyte_doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

DOC="μprog - A tiny program
Usage: uprog.sh [options]
Options:
-d --do THINGTODO Do the thing
"
"DOCOPT PARAMS"
eval "$(docopt "$@")"
8 changes: 8 additions & 0 deletions tests/test_scriptpatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,11 @@ def test_option_after_invocation(monkeypatch, capsys):
assert (
'STDIN:4 $DOCOPT_ADD_HELP has no effect when specified after invoking docopt, '
+ 'make sure to place docopt options before calling `eval "$(docopt "$@")"`.') in err


def test_multibyte_doc(monkeypatch, capsys, bash):
run = patch_file(monkeypatch, capsys, 'multibyte_doc.sh')
code, out, err = run(bash, 'invalid')
assert err == 'Usage: uprog.sh [options]\n'
assert code == 1
assert out == ''

0 comments on commit 241fb7f

Please sign in to comment.