vim: add gettext option (#10941)

fix test when built with python3
add test for gettext option
This commit is contained in:
Carter Li 2017-03-12 21:06:52 +08:00 committed by ilovezfs
parent 8272bf4b1c
commit 848e316f20

View file

@ -11,11 +11,10 @@ class Vim < Formula
sha256 "144d5c2d2e13f3b5d0f5bcf7a7e28523fa71277738959b587b9b95dea7e27295" => :yosemite
end
deprecated_option "disable-nls" => "without-nls"
deprecated_option "override-system-vi" => "with-override-system-vi"
option "with-override-system-vi", "Override system vi"
option "without-nls", "Build vim without National Language Support (translated messages, keymaps)"
option "with-gettext", "Build vim with National Language Support (translated messages, keymaps)"
option "with-client-server", "Enable client/server mode"
LANGUAGES_OPTIONAL = %w[lua python3 tcl].freeze
@ -42,6 +41,7 @@ class Vim < Formula
depends_on "lua" => :optional
depends_on "luajit" => :optional
depends_on :x11 if build.with? "client-server"
depends_on "gettext" => :optional
conflicts_with "ex-vi",
:because => "vim and ex-vi both install bin/ex and bin/view"
@ -73,7 +73,7 @@ class Vim < Formula
opts -= %w[--enable-pythoninterp]
end
opts << "--disable-nls" if build.without? "nls"
opts << "--disable-nls" if build.without? "gettext"
opts << "--enable-gui=no"
if build.with? "client-server"
@ -116,13 +116,23 @@ class Vim < Formula
end
test do
if build.with? "python"
if build.with? "python3"
(testpath/"commands.vim").write <<-EOS.undent
:python3 import vim; vim.current.buffer[0] = 'hello python3'
:wq
EOS
system bin/"vim", "-T", "dumb", "-s", "commands.vim", "test.txt"
assert_equal "hello python3", File.read("test.txt").chomp
elsif build.with? "python"
(testpath/"commands.vim").write <<-EOS.undent
:python import vim; vim.current.buffer[0] = 'hello world'
:wq
EOS
system bin/"vim", "-T", "dumb", "-s", "commands.vim", "test.txt"
assert_equal (testpath/"test.txt").read, "hello world\n"
assert_equal "hello world", File.read("test.txt").chomp
end
if build.with? "gettext"
assert_match "+gettext", shell_output("#{bin}/vim --version")
end
end
end