From 06de83cc0f2282b2217c6151277dfd6789593c2e Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 25 Jul 2018 07:52:06 +0200 Subject: Prepare tests for performance optimizations --- test/segments/aws_eb_env.spec | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'test/segments/aws_eb_env.spec') diff --git a/test/segments/aws_eb_env.spec b/test/segments/aws_eb_env.spec index 56042027..42740ea6 100755 --- a/test/segments/aws_eb_env.spec +++ b/test/segments/aws_eb_env.spec @@ -7,24 +7,30 @@ SHUNIT_PARENT=$0 function setUp() { export TERM="xterm-256color" - # Load Powerlevel9k - source powerlevel9k.zsh-theme } function testAwsEbEnvSegmentPrintsNothingIfNoElasticBeanstalkEnvironmentIsSet() { local POWERLEVEL9K_CUSTOM_WORLD='echo world' - local POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world) + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env custom_world) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)" } function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSet() { + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml cd /tmp/powerlevel9k-test - local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) - assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" rm -fr /tmp/powerlevel9k-test @@ -35,14 +41,17 @@ function testAwsEbEnvSegmentWorksIfElasticBeanstalkEnvironmentIsSetInParentDirec # Skip test, because currently we cannot detect # if the configuration is in a parent directory startSkipping # Skip test + local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS + POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) + + # Load Powerlevel9k + source powerlevel9k.zsh-theme + mkdir -p /tmp/powerlevel9k-test/.elasticbeanstalk mkdir -p /tmp/powerlevel9k-test/1/12/123/1234/12345 echo "test:\n environment: test" > /tmp/powerlevel9k-test/.elasticbeanstalk/config.yml cd /tmp/powerlevel9k-test/1/12/123/1234/12345 - local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS - POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(aws_eb_env) - assertEquals "%K{black} %F{green%}🌱 %f%F{green}test %k%F{black}%f " "$(build_left_prompt)" rm -fr /tmp/powerlevel9k-test -- cgit v1.2.3