From c8b28f50186e0e9b05853521db2889deda89df18 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Thu, 23 Oct 2025 18:37:52 +0200 Subject: [PATCH 1/2] Fixed default mime_bundle_repr --- include/xcpp/xmime.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xcpp/xmime.hpp b/include/xcpp/xmime.hpp index e849a98d..030b9985 100644 --- a/include/xcpp/xmime.hpp +++ b/include/xcpp/xmime.hpp @@ -40,7 +40,7 @@ namespace xcpp template nl::json mime_bundle_repr(const T& value) { - return detail::mime_bundle_repr_via_sstream(&value); + return detail::mime_bundle_repr_via_sstream(value); } } From 2122ff8e482e29c36c5a4cf87c49b726b5f13354 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 24 Oct 2025 08:52:14 +0200 Subject: [PATCH 2/2] Added mime_bundle_repr test --- test/test_interpreter.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test_interpreter.cpp b/test/test_interpreter.cpp index 003d7024..cfb0d7d5 100644 --- a/test/test_interpreter.cpp +++ b/test/test_interpreter.cpp @@ -15,6 +15,7 @@ #include "xeus-cpp/xutils.hpp" #include "xeus-cpp/xoptions.hpp" #include "xeus-cpp/xeus_cpp_config.hpp" +#include "xcpp/xmime.hpp" #include "../src/xparser.hpp" #include "../src/xsystem.hpp" @@ -1079,3 +1080,17 @@ TEST_SUITE("file") { infile.close(); } } + +TEST_SUITE("mime_bundle_repr") +{ + TEST_CASE("int") + { + int value = 42; + nl::json res = xcpp::mime_bundle_repr(value); + nl::json expected = { + {"text/plain", "42"} + }; + + REQUIRE(res == expected); + } +}