homebrew-core/Formula/skktools.rb
2019-10-15 08:29:13 +02:00

85 lines
2.5 KiB
Ruby

class Skktools < Formula
desc "SKK dictionary maintenance tools"
homepage "https://github.com/skk-dev/skktools"
url "https://deb.debian.org/debian/pool/main/s/skktools/skktools_1.3.4.orig.tar.gz"
sha256 "84cc5d3344362372e0dfe93a84790a193d93730178401a96248961ef161f2168"
revision 1
bottle do
cellar :any
sha256 "c10f7baf6bc379ed47fc82b5bf1dd2ae8cbc53c358f5c838e87d8440ae8c5ebd" => :catalina
sha256 "e3e3033a8f0d05939c9ebe2ab73cff7377351a36b8276337c920026c27d0a127" => :mojave
sha256 "65826868e8d1ca3d310ebc14e2aadc281b09751220e3310643b4e2aa4ab9ee68" => :high_sierra
sha256 "b190a2b730f1604ac76725e99c5fd9927ed5a7cbba905291f017b77fee1e3c85" => :sierra
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