sapling/tests/test-scm-prompt-compat.t
Greg Prosser 094b505444 scm-prompt: fix _dotfiles_scm_info
Summary: I was using """_dotfiles_scm_info '[%s] '""" in my prompt, which broke after the refactoring.  Add a unit test and fix the code.

Test Plan: wrote a test for the breakage, edited code until they all passed

Reviewers: rmcelroy, tja

Reviewed By: rmcelroy

Subscribers: mjpieters, #pe_security

Differential Revision: https://phabricator.intern.facebook.com/D4945132

Signature: t1:4945132:1493136425:4516151982d173584cf874985de9de1fed0962d5
2017-04-25 10:56:35 -07:00

38 lines
673 B
Perl

Initialize scm prompt compatibility layer
$ . $TESTDIR/../scripts/scm-prompt.sh
$ cmd() {
> "$@"
> _dotfiles_scm_info
> }
A few basic tests
$ _dotfiles_scm_info
$ hg init repo
$ cmd cd repo
(empty) (no-eol)
$ echo a > a
$ cmd hg add a
(0000000) (no-eol)
$ cmd hg commit -m 'c1'
(5cad84d) (no-eol)
$ cmd hg book active
(active) (no-eol)
Test old mode
$ export WANT_OLD_SCM_PROMPT
$ WANT_OLD_SCM_PROMPT=1
$ cmd hg book -i
5cad84d (no-eol)
$ cmd hg book active
active (no-eol)
Test format string
$ oldcmd() {
> "$@"
> _dotfiles_scm_info "g g %s g g\n"
> }
$ hg init repo
$ oldcmd cd repo
g g empty g g