Skip to content

Commit

Permalink
Merge pull request Homebrew#196522 from Homebrew/m-p-cpp-heredocs
Browse files Browse the repository at this point in the history
m-p: Use C++ language-specific heredoc delimiters
  • Loading branch information
BrewTestBot authored Nov 3, 2024
2 parents ba04b4a + 4a0771a commit 7a19848
Show file tree
Hide file tree
Showing 47 changed files with 102 additions and 102 deletions.
4 changes: 2 additions & 2 deletions Formula/m/magic_enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <magic_enum.hpp>
Expand All @@ -33,7 +33,7 @@ def install
std::cout << c1_name << std::endl;
return 0;
}
EOS
CPP

system ENV.cxx, "test.cpp", "-I#{include}", "-std=c++17", "-o", "test"
assert_equal "RED\n", shell_output(testpath/"test")
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mavsdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def install
# Force use of Clang on Mojave
ENV.clang if OS.mac?

(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <mavsdk/mavsdk.h>
using namespace mavsdk;
Expand All @@ -103,7 +103,7 @@ def install
std::cout << mavsdk.version() << std::endl;
return 0;
}
EOS
CPP
system ENV.cxx, "-std=c++17", testpath/"test.cpp", "-o", "test",
"-I#{include}", "-L#{lib}", "-lmavsdk"
assert_match "v#{version}-#{tap.user}", shell_output("./test").chomp
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mbelib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def install
end

test do
(testpath/"mb.cpp").write <<~EOS
(testpath/"mb.cpp").write <<~CPP
extern "C" {
#include "mbelib.h"
}
Expand All @@ -45,7 +45,7 @@ def install
mbe_synthesizeSilencef(float_buf);
return (float_buf[0] != 0);
}
EOS
CPP
system ENV.cxx, "mb.cpp", "-o", "test", "-L#{lib}", "-lmbe"
system "./test"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mdds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <mdds/flat_segment_tree.hpp>
int main() {
mdds::flat_segment_tree<unsigned, unsigned> fst(0, 4, 8);
}
EOS
CPP
system ENV.cxx, "test.cpp", "-o", "test",
"-std=c++17",
"-I#{include.children.first}"
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mesa-glu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <GL/glu.h>
int main(int argc, char* argv[]) {
Expand All @@ -53,7 +53,7 @@ def install
gluEndPolygon(tobj);
return 0;
}
EOS
CPP
system ENV.cxx, "-I#{include}", "test.cpp", "-L#{lib}", "-lGLU"
end
end
4 changes: 2 additions & 2 deletions Formula/m/mhash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include "mhash.h"
int main() {
MHASH td;
return 0;
}
EOS
CPP
system ENV.cc, "test.cpp", "-L#{lib}", "-lmhash", "-o", "test"
system "./test"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mlx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <cassert>
#include <mlx/mlx.h>
Expand All @@ -103,7 +103,7 @@ def install
assert(z.data<float>()[2] == 4.0f);
assert(z.data<float>()[3] == 5.0f);
}
EOS
CPP
system ENV.cxx, "test.cpp", "-std=c++17",
"-I#{include}", "-L#{lib}", "-lmlx",
"-o", "test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/molten-vk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <vulkan/vulkan.h>
int main(void) {
const char *extensionNames[] = { "VK_KHR_surface" };
Expand All @@ -199,7 +199,7 @@ def install
vkCreateInstance(&instanceCreateInfo, NULL, &inst);
return 0;
}
EOS
CPP
system ENV.cc, "-o", "test", "test.cpp", "-I#{include}", "-I#{libexec/"include"}", "-L#{lib}", "-lMoltenVK"
system "./test"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/msgpack-cxx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def install

test do
# Reference: https://github.com/msgpack/msgpack-c/blob/cpp_master/QUICKSTART-CPP.md
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <msgpack.hpp>
#include <vector>
#include <string>
Expand Down Expand Up @@ -54,7 +54,7 @@ def install
std::vector<std::string> rvec;
obj.convert(rvec);
}
EOS
CPP

system ENV.cxx, "-std=c++14", "-o", "test", "test.cpp", "-I#{include}"
assert_equal "[\"Hello\",\"MessagePack\"]\n", `./test`
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mstch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def pc_file
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <mstch/mstch.hpp>
#include <cassert>
#include <string>
Expand All @@ -56,7 +56,7 @@ def pc_file
assert(mstch::render(view, context) == "Hello, world");
}
EOS
CPP

system ENV.cxx, "test.cpp", "-L#{lib}", "-lmstch", "-std=c++11", "-o", "test"
system "./test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/muparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <muParser.h>
Expand Down Expand Up @@ -60,7 +60,7 @@ def install
return 0;
}
EOS
CPP

system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", "-I#{include}", "-L#{lib}", "-lmuparser"
system "./test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mysql++.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <mysql++/cmdline.h>
int main(int argc, char *argv[]) {
mysqlpp::examples::CommandLine cmdline(argc, argv);
Expand All @@ -52,7 +52,7 @@ def install
}
return 0;
}
EOS
CPP
system ENV.cxx, "test.cpp", "-I#{Formula["mysql-client"].opt_include}/mysql",
"-L#{lib}", "-lmysqlpp", "-o", "test"
system "./test", "-u", "foo", "-p", "bar"
Expand Down
4 changes: 2 additions & 2 deletions Formula/m/mysql-connector-c++.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <mysqlx/xdevapi.h>
int main(void)
Expand All @@ -53,7 +53,7 @@ def install
::std::cout <<"ERROR: " << err << ::std::endl;
return 0;
}
EOS
CPP
system ENV.cxx, "test.cpp", "-std=c++11", "-I#{include}",
"-L#{lib}", "-lmysqlcppconnx", "-o", "test"
output = shell_output("./test")
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nanoflann.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <nanoflann.hpp>
int main() {
nanoflann::KNNResultSet<size_t> resultSet(1);
return 0;
}
EOS
CPP
system ENV.cxx, "test.cpp", "-o", "test", "-std=c++11"
system "./test"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nanomsgxx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <nnxx/message.h>
#include <nnxx/pair.h>
Expand All @@ -83,7 +83,7 @@ def install
std::cout << msg << std::endl;
return 0;
}
EOS
CPP

system ENV.cxx, "-std=c++11", "test.cpp", "-L#{lib}", "-lnnxx"

Expand Down
4 changes: 2 additions & 2 deletions Formula/n/ncnn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def install
vulkan = 0
end

(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <cassert>
#include <ncnn/gpu.h>
#include <ncnn/mat.h>
Expand All @@ -91,7 +91,7 @@ def install
return 0;
}
EOS
CPP

system ENV.cxx, "test.cpp", "-std=c++11",
"-I#{include}", "-L#{lib}", "-lncnn",
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/netcdf-cxx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <netcdf>
Expand All @@ -66,7 +66,7 @@ def install
auto data = dataFile.addVar("data", netCDF::ncInt, {xDim, yDim});
data.putVar(dataOut);
}
EOS
CPP
system ENV.cxx, "test.cpp", "-std=c++11", "-L#{lib}", "-I#{include}", "-lnetcdf-cxx4", "-o", "test"
system "./test"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/numcpp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <NumCpp.hpp>
Expand All @@ -30,7 +30,7 @@ def install
for (int i = 0; i < nc::shape(a).cols; ++i)
std::cout << a[i] << std::endl;
}
EOS
CPP
system ENV.cxx, "-std=c++17", "test.cpp", "-o", "test", "-I#{include}"
assert_equal "1\n5\n9\n", shell_output("./test")
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nuspell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def install
hello
EOS

(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <iostream>
#include <fstream>
#include <nuspell/dictionary.hxx>
Expand All @@ -81,7 +81,7 @@ def install
return 0;
}
EOS
CPP

icu4c = deps.find { |dep| dep.name.match?(/^icu4c(@\d+)?$/) }
.to_formula
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/octomap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <cassert>
#include <octomap/octomap.h>
int main() {
octomap::OcTree tree(0.05);
assert(tree.size() == 0);
return 0;
}
EOS
CPP
system ENV.cxx, "test.cpp", "-I#{include}", "-L#{lib}",
"-loctomath", "-loctomap", "-o", "test"
system "./test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/ode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <ode/ode.h>
int main() {
dInitODE();
dCloseODE();
return 0;
}
EOS
CPP
system ENV.cc, "test.cpp", "-I#{include}/ode", "-L#{lib}", "-lode",
"-L#{Formula["libccd"].opt_lib}", "-lccd", "-lm", "-lpthread",
"-o", "test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/ompl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <ompl/base/spaces/RealVectorBounds.h>
#include <cassert>
int main(int argc, char *argv[]) {
Expand All @@ -56,7 +56,7 @@ def install
bounds.setHigh(5);
assert(bounds.getVolume() == 5 * 5 * 5);
}
EOS
CPP

system ENV.cxx, "test.cpp", "-I#{include}/ompl-#{version.major_minor}", "-L#{lib}", "-lompl", "-o", "test"
system "./test"
Expand Down
Loading

0 comments on commit 7a19848

Please sign in to comment.