class PgBsdIndent < Formula
  desc "Postgres' version of the BSD indent program"
  homepage "https://git.postgresql.org/gitweb/?p=pg_bsd_indent.git;a=summary"
  url "https://git.postgresql.org/git/pg_bsd_indent.git",
      tag:      "REL_2_1_1",
      revision: "e6a167ea4a864af35c61421af8ea4b0cbca39612"
  license all_of: ["BSD-2-Clause", "BSD-3-Clause", "BSD-4-Clause"]

  depends_on "postgresql"

  def install
    system "make"
    bin.install "pg_bsd_indent"
  end

  test do
    (testpath/"test.c").write("int main(){ return 0; }")
    system "#{bin}/pg_bsd_indent", "test.c"
    assert_equal File.read("test.c"), <<~EOS
      int
      main()
      {
      \treturn 0;
      }
    EOS
  end
end
