homebrew-core/Formula/skktools.rb
2018-08-15 20:41:36 +01:00

83 lines
2.4 KiB
Ruby

class Skktools < Formula
desc "SKK dictionary maintenance tools"
homepage "http://openlab.jp/skk/index-j.html"
url "http://openlab.ring.gr.jp/skk/tools/skktools-1.3.4.tar.gz"
sha256 "84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168"
bottle do
cellar :any
sha256 "ba33dffb6c11d2c0994f0248a324e6662dda598e3a90dffc06de2a256eb91f3e" => :high_sierra
sha256 "2a067c0d5f053faeaf0c2b3f6d32d26306164e08a5f95ad4d25c562f5308f931" => :sierra
sha256 "90d7201d2e94c37a526005541256485e81e1b5cdba51fd751d6255bcbc1d8069" => :el_capitan
end
depends_on "pkg-config" => :build
depends_on "glib"
def install
system "./configure", "--prefix=#{prefix}",
"--with-skkdic-expr2"
system "make", "CC=#{ENV.cc}"
ENV.deparallelize
system "make", "install"
end
test do
test_dic = <<~EOS.strip.tap { |s| s.encode("euc-jis-2004") }
s //
k //
i //
EOS
(testpath/"SKK-JISYO.TEST").write test_dic
test_shuffle = <<~EOS.tap { |s| s.encode("euc-jis-2004") }
s //
i //
k //
EOS
expect_shuffle = <<~EOS.tap { |s| s.encode("euc-jis-2004") }
;; okuri-ari entries.
s //
k //
i //
EOS
test_sp1 = <<~EOS.strip.tap { |s| s.encode("euc-jis-2004") }
s //
k //
EOS
(testpath/"test.sp1").write test_sp1
test_sp2 = <<~EOS.strip.tap { |s| s.encode("euc-jis-2004") }
k //
i //
EOS
(testpath/"test.sp2").write test_sp2
test_sp3 = <<~EOS.strip.tap { |s| s.encode("euc-jis-2004") }
i //
EOS
(testpath/"test.sp3").write test_sp3
expect_expr = <<~EOS.tap { |s| s.encode("euc-jis-2004") }
;; okuri-ari entries.
s //
k //
EOS
expect_count = "SKK-JISYO.TEST: 3 candidates\n"
actual_count = shell_output("#{bin}/skkdic-count SKK-JISYO.TEST")
assert_equal expect_count, actual_count
actual_shuffle = pipe_output("#{bin}/skkdic-sort", test_shuffle, 0)
assert_equal expect_shuffle, actual_shuffle
["skkdic-expr", "skkdic-expr2"].each do |cmd|
expr_cmd = "#{bin}/#{cmd} test.sp1 + test.sp2 - test.sp3"
actual_expr = shell_output(expr_cmd)
assert_equal expect_expr, pipe_output("#{bin}/skkdic-sort", actual_expr)
end
end
end