1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-01 23:50:06 +00:00
powerlevel10k/test/segments/rust_version.spec
Charles Peterson 264897a426 color names and fixes
- fix for packageName truncated by POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER
     - processing the pwd/HOME replacement ONCE.
     - fix tests for named colors
     - use color names by default to allow dark/light themes to adjust colors based on names
2017-11-25 12:46:45 -06:00

40 lines
963 B
Bash
Executable file

#!/usr/bin/env zsh
#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
# Required for shunit2 to run correctly
setopt shwordsplit
SHUNIT_PARENT=$0
function setUp() {
export TERM="xterm-256color"
# Load Powerlevel9k
source powerlevel9k.zsh-theme
}
function mockRust() {
echo 'rustc 0.4.1a-alpha'
}
function testRust() {
alias rustc=mockRust
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(rust_version)
assertEquals "%K{darkorange} %F{black}Rust 0.4.1a-alpha %k%F{darkorange}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unalias rustc
}
function testRustPrintsNothingIfRustIsNotAvailable() {
alias rustc=noRust
POWERLEVEL9K_CUSTOM_WORLD='echo world'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world rust_version)
assertEquals "%K{white} %F{black}world %k%F{white}%f " "$(build_left_prompt)"
unset POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
unset POWERLEVEL9K_CUSTOM_WORLD
unalias rustc
}
source shunit2/source/2.1/src/shunit2