[test] Clear environment variables

This commit is contained in:
Junegunn Choi 2016-08-13 19:26:36 +09:00
parent 1e74dbb937
commit 822b86942c
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -36,6 +36,10 @@ end
class Shell class Shell
class << self class << self
def unsets
'unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS FZF_CTRL_T_COMMAND FZF_CTRL_T_OPTS FZF_ALT_C_COMMAND FZF_ALT_C_OPTS FZF_CTRL_R_OPTS;'
end
def bash def bash
'PS1= PROMPT_COMMAND= bash --rcfile ~/.fzf.bash' 'PS1= PROMPT_COMMAND= bash --rcfile ~/.fzf.bash'
end end
@ -45,6 +49,10 @@ class Shell
FileUtils.cp File.expand_path('~/.fzf.zsh'), '/tmp/fzf-zsh/.zshrc' FileUtils.cp File.expand_path('~/.fzf.zsh'), '/tmp/fzf-zsh/.zshrc'
'PS1= PROMPT_COMMAND= HISTSIZE=100 ZDOTDIR=/tmp/fzf-zsh zsh' 'PS1= PROMPT_COMMAND= HISTSIZE=100 ZDOTDIR=/tmp/fzf-zsh zsh'
end end
def fish
'fish'
end
end end
end end
@ -57,11 +65,11 @@ class Tmux
@win = @win =
case shell case shell
when :bash when :bash
go("new-window -d -P -F '#I' '#{Shell.bash}'").first go("new-window -d -P -F '#I' '#{Shell.unsets + Shell.bash}'").first
when :zsh when :zsh
go("new-window -d -P -F '#I' '#{Shell.zsh}'").first go("new-window -d -P -F '#I' '#{Shell.unsets + Shell.zsh}'").first
when :fish when :fish
go("new-window -d -P -F '#I' 'fish'").first go("new-window -d -P -F '#I' '#{Shell.unsets + Shell.fish}'").first
else else
raise "Unknown shell: #{shell}" raise "Unknown shell: #{shell}"
end end
@ -153,12 +161,6 @@ class TestBase < Minitest::Test
@temp_suffix].join '-' @temp_suffix].join '-'
end end
def setup
ENV.delete 'FZF_DEFAULT_OPTS'
ENV.delete 'FZF_CTRL_T_COMMAND'
ENV.delete 'FZF_DEFAULT_COMMAND'
end
def readonce def readonce
wait { File.exists?(tempname) } wait { File.exists?(tempname) }
File.read(tempname) File.read(tempname)