Merge pull request #207012 from Homebrew/bump-tailwindcss-4.0.5
[Homebrew/homebrew-core.git] / Formula / t / tabulate.rb
blob2ace6ad0f0441cba3222547833ba7737d9536898
1 class Tabulate < Formula
2   desc "Table Maker for Modern C++"
3   homepage "https://github.com/p-ranav/tabulate"
4   url "https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz"
5   sha256 "16b289f46306283544bb593f4601e80d6ea51248fde52e910cc569ef08eba3fb"
6   license all_of: [
7     "MIT",
8     "BSL-1.0",      # {optional,string_view,variant}_lite.hpp
9     "BSD-3-Clause", # termcolor.hpp
10   ]
12   bottle do
13     sha256 cellar: :any_skip_relocation, all: "636ac9d2ecadd40138dc030e967b464b296cba28f5eb180377c7e18d18778f97"
14   end
16   depends_on "cmake" => :build
18   def install
19     system "cmake", "-S", ".", "-B", "build", *std_cmake_args
20     system "cmake", "--build", "build"
21     system "cmake", "--install", "build"
22   end
24   test do
25     # https://github.com/p-ranav/tabulate/blob/master/samples/shape.cpp
26     (testpath/"test.cpp").write <<~CPP
27       #include <tabulate/table.hpp>
28       using namespace tabulate;
29       using Row_t = Table::Row_t;
31       void print_shape(Table &table) {
32         auto shape = table.shape();
33         std::cout << "Shape: (" << shape.first << ", " << shape.second << ")" << std::endl;
34       }
36       int main() {
37         Table table;
38         table.add_row(Row_t{"Command", "Description"});
39         table.add_row(Row_t{"git status", "List all new or modified files"});
40         table.add_row(Row_t{"git diff", "Show file differences that haven't been staged"});
41         std::cout << table << std::endl;
42         print_shape(table);
43       }
44     CPP
45     system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test"
46     assert_match "Shape: (63, 7)", shell_output("./test")
47   end
48 end