From c170c30119441a6b9667e7646f065710973ffe13 Mon Sep 17 00:00:00 2001 From: Oliver Lee Date: Sat, 15 Jul 2023 09:13:30 -0700 Subject: [PATCH] Add `fmt` as a dependency Change-Id: I8df98ad421c0dce482ce2d8d5c1304c2d0936c4d --- WORKSPACE.bazel | 14 ++++++++++++++ test/BUILD.bazel | 1 + test/dummy_test.cpp | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 9ec4325..51830fb 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -110,6 +110,20 @@ register_toolchains( "@gcc_12_toolchain//:toolchain", ) +FMT_VERSION = "dd5a9691f992f7f257243cbecb516a4ab584dcde" + +http_archive( + name = "fmt", + patch_cmds = [ + "mv support/bazel/.bazelversion .bazelversion", + "mv support/bazel/BUILD.bazel BUILD.bazel", + "mv support/bazel/WORKSPACE.bazel WORKSPACE.bazel", + ], + sha256 = "02289e247321e4984fcfc185e1bcaf6ace9622ad6e034f326677da4b53c7a92d", + strip_prefix = "fmt-%s" % FMT_VERSION, + url = "https://github.com/fmtlib/fmt/archive/%s.tar.gz" % FMT_VERSION, +) + BOOST_UT_VERSION = "e53a47d37bc594e80bd5f1b8dc1ade8dce4429d3" http_archive( diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 9953459..4366d60 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -6,5 +6,6 @@ cc_test( srcs = ["dummy_test.cpp"], deps = [ "@boost_ut", + "@fmt", ], ) diff --git a/test/dummy_test.cpp b/test/dummy_test.cpp index c17795c..f218cf6 100644 --- a/test/dummy_test.cpp +++ b/test/dummy_test.cpp @@ -1,9 +1,15 @@ #include +#include + auto main() -> int { using ::boost::ut::expect; using ::boost::ut::test; - test("true is true") = [] { expect(true); }; + test("true is true") = [] { + const auto s = fmt::format("The answer is {}.", 42); + + expect("The answer is 42." == s); + }; }