Strip anything but prompt from tcsh tests

There are some problems with a number of spaces on travis: it differs. Cannot 
use the same code as for fish because output looks like

    {prompt}{spaces}^[0m ^[[{number}D

and both `{spaces}` and `{number}` differ on my machine and in travis.
This commit is contained in:
ZyX 2014-01-27 00:22:38 +04:00
parent fe99e252e9
commit c648178be0
2 changed files with 23 additions and 19 deletions

View File

@ -41,4 +41,11 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
line = line[start : end+4] + '\n' line = line[start : end+4] + '\n'
except ValueError: except ValueError:
line = '' line = ''
elif shell == 'tcsh':
try:
start = line.index('\033[0;')
end = line.index(' ', start)
line = line[start : end] + '\033[0m\n'
except ValueError:
line = ''
W.write(line) W.write(line)

View File

@ -1,19 +1,16 @@
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd    cd .git   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git    cd ..   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd    setenv VIRTUAL_ENV $HOME:q"/.virtenvs/some-virtual-environment"   HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd    unsetenv VIRTUAL_ENV   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd    bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
[1] PID   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd    false # Warning: currently tcsh bindings do not support job count   HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1    kill `cat pid` ; sleep 1s   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  
[1] + Terminated bash -c echo $$>pid ; while true ; do sleep 0.1s ; done   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd    cd $DIR1:q   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  \[\]  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m    cd ../$DIR2:q   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  %%  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H    cd ../'\[\]'   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  #[bold]  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  \[\]    cd ../'%%'   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  (echo)  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  %%    cd ../'#[bold]'   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  $(echo)  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  #[bold]    cd ../'(echo)'   HOSTNAME  USER   BRANCH  ⋯  shell  3rd  `echo`  
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  (echo)    cd ../'$(echo)'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  $(echo)    cd ../'`echo`'
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  `echo`    false