From 10c0c5be5db9599d2f021a85d72c4cd71f51cf00 Mon Sep 17 00:00:00 2001 From: Foo Date: Sun, 1 Mar 2015 17:24:44 +0300 Subject: [PATCH] Add above tests for bash, fish and zsh --- tests/test_shells/bash.daemon.ok | 11 ++++++++++ tests/test_shells/bash.nodaemon.ok | 11 ++++++++++ tests/test_shells/fish.ok | 16 +++++++++++++++ tests/test_shells/input.bash | 31 +++++++++++++++++++++++++++++ tests/test_shells/input.fish | 32 ++++++++++++++++++++++++++++++ tests/test_shells/input.zsh | 31 +++++++++++++++++++++++++++++ tests/test_shells/zsh.daemon.ok | 11 ++++++++++ tests/test_shells/zsh.nodaemon.ok | 11 ++++++++++ 8 files changed, 154 insertions(+) diff --git a/tests/test_shells/bash.daemon.ok b/tests/test_shells/bash.daemon.ok index e4535b1e..4f25eb13 100644 --- a/tests/test_shells/bash.daemon.ok +++ b/tests/test_shells/bash.daemon.ok @@ -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 diff --git a/tests/test_shells/bash.nodaemon.ok b/tests/test_shells/bash.nodaemon.ok index 56dd1fc5..9bfc9cfe 100644 --- a/tests/test_shells/bash.nodaemon.ok +++ b/tests/test_shells/bash.nodaemon.ok @@ -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 diff --git a/tests/test_shells/fish.ok b/tests/test_shells/fish.ok index c69abfc5..e1044450 100644 --- a/tests/test_shells/fish.ok +++ b/tests/test_shells/fish.ok @@ -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!»   diff --git a/tests/test_shells/input.bash b/tests/test_shells/input.bash index 0a1c0165..bbd8d0bb 100644 --- a/tests/test_shells/input.bash +++ b/tests/test_shells/input.bash @@ -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 diff --git a/tests/test_shells/input.fish b/tests/test_shells/input.fish index 968248f1..4be37c31 100644 --- a/tests/test_shells/input.fish +++ b/tests/test_shells/input.fish @@ -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 diff --git a/tests/test_shells/input.zsh b/tests/test_shells/input.zsh index 7775ba97..ab71ee6c 100644 --- a/tests/test_shells/input.zsh +++ b/tests/test_shells/input.zsh @@ -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 diff --git a/tests/test_shells/zsh.daemon.ok b/tests/test_shells/zsh.daemon.ok index 53ff5b4c..daf415dc 100644 --- a/tests/test_shells/zsh.daemon.ok +++ b/tests/test_shells/zsh.daemon.ok @@ -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 diff --git a/tests/test_shells/zsh.nodaemon.ok b/tests/test_shells/zsh.nodaemon.ok index 5883a780..6a813f93 100644 --- a/tests/test_shells/zsh.nodaemon.ok +++ b/tests/test_shells/zsh.nodaemon.ok @@ -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