<commit_before>require "formula"

class GnuIndent < Formula
  homepage "https://www.gnu.org/software/indent/"
  url "http://ftpmirror.gnu.org/indent/indent-2.2.10.tar.gz"
  mirror "https://ftp.gnu.org/gnu/indent/indent-2.2.10.tar.gz"
  sha1 "20fa8a7a4af6670c3254c8b87020291c3db37ed1"

  depends_on "gettext"

  deprecated_option "default-names" => "with-default-names"

  option "with-default-names", "Do not prepend 'g' to the binary"

  # Fix broken include and missing build dependency
  patch :DATA

  def install
    args = %W[
      --disable-debug
      --disable-dependency-tracking
      --prefix=#{prefix}
      --mandir=#{man}
      ]

    args << "--program-prefix=g" if build.without? "default-names"

    system "./configure", *args
    system "make", "install"
  end
end

__END__<commit_msg>gnu-indent: add test<commit_after>class GnuIndent < Formula
  homepage "https://www.gnu.org/software/indent/"
  url "http://ftpmirror.gnu.org/indent/indent-2.2.10.tar.gz"
  mirror "https://ftp.gnu.org/gnu/indent/indent-2.2.10.tar.gz"
  sha1 "20fa8a7a4af6670c3254c8b87020291c3db37ed1"

  depends_on "gettext"

  deprecated_option "default-names" => "with-default-names"

  option "with-default-names", "Do not prepend 'g' to the binary"

  # Fix broken include and missing build dependency
  patch :DATA

  def install
    args = %W[
      --disable-debug
      --disable-dependency-tracking
      --prefix=#{prefix}
      --mandir=#{man}
      ]

    args << "--program-prefix=g" if build.without? "default-names"

    system "./configure", *args
    system "make", "install"
  end

  test do
    (testpath/"test.c").write("int main(){ return 0; }")
    system "#{bin}/gindent", "test.c"
    assert_equal File.read("test.c"), <<-EOS.undent
      int
      main ()
      {
        return 0;
      }
    EOS
  end
end

__END__
{'fraction_non_alphanumeric': 0.14972677595628414, 'fraction_numerical': 0.03934426229508197, 'mean_word_length': 2.887473460721868, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1756138', 'n_tokens_mistral': 704, 'n_tokens_neox': 655, 'n_words': 133}