Skip to content

Commit

Permalink
[ysh prompt] Adjust error message and spec test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Jan 30, 2024
1 parent 7e1d31f commit 73339d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion osh/prompt.py
Expand Up @@ -200,7 +200,7 @@ def PromptSubst(self, ch, arg=None):
# TODO: Handle more codes
# R(r'\\[adehHjlnrstT@AuvVwW!#$\\]', Id.PS_Subst),
if r is None:
r = _ERROR_FMT % (r'\%s not implemented in $PS1' % ch)
r = _ERROR_FMT % (r'\%s is invalid or unimplemented in $PS1' % ch)

return r

Expand Down
13 changes: 9 additions & 4 deletions spec/ysh-prompt.test.sh
Expand Up @@ -23,16 +23,21 @@ pass

#### promptVal() with invalid chars

var x = _io->promptVal('ZZ')
echo x=$x

# \D{} will be supported with date and time functions
var x = _io->promptVal('D')
echo x=$x

# something else
var x = _io->promptVal('/')
echo x=$x

var x = _io->promptVal('ZZ')
echo x=$x

## status: 3
## STDOUT:
x=<Error: \ZZ not implemented in $PS1>
x=<Error: \D{} not in promptVal()>
x=<Error: \/ is invalid or unimplemented in $PS1>
## END


Expand Down

0 comments on commit 73339d6

Please sign in to comment.