Add above tests for bash, fish and zsh

This commit is contained in:
Foo 2015-03-01 17:24:44 +03:00
parent 4a3798b43b
commit 10c0c5be5d
8 changed files with 154 additions and 0 deletions

View File

@ -26,5 +26,16 @@ def
  BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'
  BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`'
  BRANCH  ⋯  shell  3rd  `echo`  cd ../'«Unicode!»'
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above "$ABOVE_LEFT"
  BRANCH  ⋯  shell  3rd  «Unicode!»  export DISPLAYED_ENV_VAR=foo
 foo  
  BRANCH  ⋯  shell  3rd  «Unicode!»  unset DISPLAYED_ENV_VAR
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above "$ABOVE_FULL"
                                                                                                                                                                                                                                                                                                            
  BRANCH  ⋯  shell  3rd  «Unicode!»  export DISPLAYED_ENV_VAR=foo
                                                                                                                                                                                                                                                                                                       foo 
  BRANCH  ⋯  shell  3rd  «Unicode!»  unset DISPLAYED_ENV_VAR
                                                                                                                                                                                                                                                                                                            
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.dividers.left.hard \$ABC
  BRANCH $ABC⋯  shell  3rd  «Unicode!» $ABCfalse

View File

@ -26,5 +26,16 @@ def
  BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'
  BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`'
  BRANCH  ⋯  shell  3rd  `echo`  cd ../'«Unicode!»'
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above "$ABOVE_LEFT"
  BRANCH  ⋯  shell  3rd  «Unicode!»  export DISPLAYED_ENV_VAR=foo
 foo  
  BRANCH  ⋯  shell  3rd  «Unicode!»  unset DISPLAYED_ENV_VAR
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above "$ABOVE_FULL"
                                                                                                                                                                                                                                                                                                            
  BRANCH  ⋯  shell  3rd  «Unicode!»  export DISPLAYED_ENV_VAR=foo
                                                                                                                                                                                                                                                                                                       foo 
  BRANCH  ⋯  shell  3rd  «Unicode!»  unset DISPLAYED_ENV_VAR
                                                                                                                                                                                                                                                                                                            
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.segments.above
  BRANCH  ⋯  shell  3rd  «Unicode!»  set_theme_option default_leftonly.dividers.left.hard \$ABC
  BRANCH $ABC⋯  shell  3rd  «Unicode!» $ABCfalse

View File

@ -19,6 +19,22 @@
   BRANCH 
   BRANCH 
   BRANCH 
 USER  ⋯  shell  3rd  «Unicode!»  
   BRANCH 
   BRANCH 
   BRANCH 
 foo  
 USER  ⋯  shell  3rd  «Unicode!»  
   BRANCH 
   BRANCH 
   BRANCH 
                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                      foo 
                                                                                                                                                                                                                                                                                                           
 USER  ⋯  shell  3rd  «Unicode!»  
   BRANCH 
   BRANCH 
   BRANCH 
 INSERT  USER  ⋯  shell  3rd  «Unicode!»  
   BRANCH 
 DEFAULT  USER  ⋯  shell  3rd  «Unicode!»  

View File

@ -5,6 +5,30 @@ set_theme() {
export POWERLINE_CONFIG_OVERRIDES="ext.shell.theme=$1"
}
set_theme_option default_leftonly.segment_data.hostname.args.only_if_ssh false
ABOVE_LEFT='[{
"left": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
ABOVE_FULL='[{
"left": [
{
"type": "string",
"name": "background",
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
set_theme default_leftonly
export VIRTUAL_ENV=
source powerline/bindings/bash/powerline.sh
@ -31,6 +55,13 @@ cd ../'(echo)'
cd ../'$(echo)'
cd ../'`echo`'
cd ../'«Unicode!»'
set_theme_option default_leftonly.segments.above "$ABOVE_LEFT"
export DISPLAYED_ENV_VAR=foo
unset DISPLAYED_ENV_VAR
set_theme_option default_leftonly.segments.above "$ABOVE_FULL"
export DISPLAYED_ENV_VAR=foo
unset DISPLAYED_ENV_VAR
set_theme_option default_leftonly.segments.above
set_theme_option default_leftonly.dividers.left.hard \$ABC
false
true is the last line

View File

@ -4,6 +4,31 @@ end
function set_theme
set -g -x POWERLINE_CONFIG_OVERRIDES "ext.shell.theme=$argv"
end
set -g -x POWERLINE_
set -g ABOVE_LEFT '[{
"left": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
set -g ABOVE_FULL '[{
"left": [
{
"type": "string",
"name": "background",
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
set_theme_option default_leftonly.segment_data.hostname.args.only_if_ssh false
set_theme default_leftonly
set fish_function_path "$PWD/powerline/bindings/fish" $fish_function_path
@ -30,6 +55,13 @@ cd ../'$(echo)'
cd ../'`echo`'
cd ../'«Unicode!»'
set_theme default
set_theme_option default.segments.above "$ABOVE_LEFT"
set -g -x DISPLAYED_ENV_VAR foo
set -g -x -e DISPLAYED_ENV_VAR
set_theme_option default.segments.above "$ABOVE_FULL"
set -g -x DISPLAYED_ENV_VAR foo
set -g -x -e DISPLAYED_ENV_VAR
set_theme_option default.segments.above ''
set -g fish_key_bindings fish_vi_key_bindings
ii
false

View File

@ -16,6 +16,30 @@ fi
source powerline/bindings/zsh/powerline.zsh
set_theme_option default_leftonly.segment_data.hostname.args.only_if_ssh false
set_theme_option default.segment_data.hostname.args.only_if_ssh false
ABOVE_LEFT='[{
"left": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
ABOVE_FULL='[{
"left": [
{
"type": "string",
"name": "background",
"draw_hard_divider": false,
"width": "auto"
}
],
"right": [
{
"function": "powerline.segments.common.env.environment",
"args": {"variable": "DISPLAYED_ENV_VAR"}
}
]
}]'
set_theme default_leftonly
export VIRTUAL_ENV=
cd tests/shell/3rd
@ -51,6 +75,13 @@ done
1
cd .
cd .
set_theme_option default.segments.above "$ABOVE_LEFT"
export DISPLAYED_ENV_VAR=foo
unset DISPLAYED_ENV_VAR
set_theme_option default.segments.above "$ABOVE_FULL"
export DISPLAYED_ENV_VAR=foo
unset DISPLAYED_ENV_VAR
set_theme_option default.segments.above
hash -d foo=$PWD:h ; cd .
set_theme_option default.dividers.left.hard \$ABC
true

View File

@ -36,6 +36,17 @@ abc
def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above "$ABOVE_LEFT"
 INSERT  ⋯  tests  shell  3rd  export DISPLAYED_ENV_VAR=foo
 foo  
 INSERT  ⋯  tests  shell  3rd  unset DISPLAYED_ENV_VAR
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above "$ABOVE_FULL"
                                                                                                                                                                                                                                                                                                           
 INSERT  ⋯  tests  shell  3rd  export DISPLAYED_ENV_VAR=foo
                                                                                                                                                                                                                                                                                                      foo 
 INSERT  ⋯  tests  shell  3rd  unset DISPLAYED_ENV_VAR
                                                                                                                                                                                                                                                                                                           
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  set_theme_option default.dividers.left.hard \$ABC
 INSERT $ABC~foo  3rd $ABCtrue

View File

@ -36,6 +36,17 @@ abc
def
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  cd .
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above "$ABOVE_LEFT"
 INSERT  ⋯  tests  shell  3rd  export DISPLAYED_ENV_VAR=foo
 foo  
 INSERT  ⋯  tests  shell  3rd  unset DISPLAYED_ENV_VAR
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above "$ABOVE_FULL"
                                                                                                                                                                                                                                                                                                           
 INSERT  ⋯  tests  shell  3rd  export DISPLAYED_ENV_VAR=foo
                                                                                                                                                                                                                                                                                                      foo 
 INSERT  ⋯  tests  shell  3rd  unset DISPLAYED_ENV_VAR
                                                                                                                                                                                                                                                                                                           
 INSERT  ⋯  tests  shell  3rd  set_theme_option default.segments.above
 INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd .
 INSERT  ~foo  3rd  set_theme_option default.dividers.left.hard \$ABC
 INSERT $ABC~foo  3rd $ABCtrue