Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace: Upgrade fmt to latest release 7.1.0 #14272

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/pydrake/systems/test/analysis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_simulator_status(self):
status = simulator.AdvanceTo(1.)
self.assertEqual(
status.FormatMessage(),
"Simulator successfully reached the boundary time (1.0).")
"Simulator successfully reached the boundary time (1).")
self.assertTrue(status.succeeded())
self.assertEqual(status.boundary_time(), 1.)
self.assertEqual(status.return_time(), 1.)
Expand Down
2 changes: 1 addition & 1 deletion common/test/text_logging_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GTEST_TEST(TextLoggingTest, SmokeTest) {
// Check that floating point values format sensibly. We'll just test fmt
// directly, since we know that spdlog uses it internally.
GTEST_TEST(TextLoggingTest, FloatingPoint) {
EXPECT_EQ(fmt::format("{}", 1.0), "1.0");
EXPECT_EQ(fmt::format("{:#}", 1.0), "1.0");
// This number is particularly challenging.
EXPECT_EQ(fmt::format("{}", 0.009), "0.009");
}
Expand Down
2 changes: 1 addition & 1 deletion common/text_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ not be compiled if debugging is turned off (-DNDEBUG is set):
DRAKE_LOGGER_DEBUG("message: {}", something_conditionally_compiled);
</pre>
The format string syntax is fmtlib; see https://fmt.dev/7.0.3/syntax.html.
The format string syntax is fmtlib; see https://fmt.dev/7.1.0/syntax.html.
In particular, any class that overloads `operator<<` for `ostream` can be
printed without any special handling.
*/
Expand Down
4 changes: 2 additions & 2 deletions common/trajectories/test/discrete_time_trajectory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ GTEST_TEST(DiscreteTimeTrajectoryTest, ValueThrowsTest) {
DiscreteTimeTrajectory<double> traj(times, values);

DRAKE_EXPECT_THROWS_MESSAGE(traj.value(-1), std::runtime_error,
"Value requested at time -1.0 does not match .*");
"Value requested at time -1 does not match .*");
DRAKE_EXPECT_THROWS_MESSAGE(traj.value(0.4), std::runtime_error,
"Value requested at time 0.4 does not match .*");
DRAKE_EXPECT_THROWS_MESSAGE(traj.value(1), std::runtime_error,
"Value requested at time 1.0 does not match .*");
"Value requested at time 1 does not match .*");

const double kLooseTolerance = 0.1;
DiscreteTimeTrajectory<double> traj_w_loose_tol(times, values,
Expand Down
7 changes: 6 additions & 1 deletion common/yaml/yaml_write_archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <variant>
Expand Down Expand Up @@ -249,7 +250,11 @@ class YamlWriteArchive final {
void VisitScalar(const NVP& nvp) {
using T = typename NVP::value_type;
const T& value = *nvp.value();
root_[nvp.name()] = fmt::format("{}", value);
if constexpr (std::is_floating_point_v<T>) {
root_[nvp.name()] = fmt::format("{:#}", value);
} else {
root_[nvp.name()] = fmt::format("{}", value);
}
}

template <typename NVP>
Expand Down
2 changes: 1 addition & 1 deletion multibody/parsing/test/detail_scene_graph_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ GTEST_TEST(SceneGraphParserDetail, ParseVisualMaterial) {
MakeVisualPropertiesFromSdfVisual(*sdf_visual, NoopResolveFilename),
std::runtime_error,
"All values must be within the range \\[0, 1\\]. Values provided: "
"\\(r=0.0, g=1.0, b=255.0, a=1.0\\)");
"\\(r=0, g=1, b=255, a=1\\)");
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/workspace/fmt/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def fmt_repository(
repository = "fmtlib/fmt",
# When changing the fmt version, also update the URL in the file
# overview docstring of drake/common/text_logging.h.
commit = "7.0.3",
sha256 = "b4b51bc16288e2281cddc59c28f0b4f84fed58d016fb038273a09f05f8473297", # noqa
commit = "7.1.0",
sha256 = "a53bce7e3b7ee8c7374723262a43356afff176b1684b86061748409e6f8b56c5", # noqa
build_file = "@drake//tools/workspace/fmt:package.BUILD.bazel",
mirrors = mirrors,
)