BareGit

Add test case for inline macro definitions

Author: MetroWind <chris.corsair@gmail.com>
Date: Sat Jan 17 17:18:10 2026 -0800
Commit: 51b48a3749a174dd94e27e0b1b1e5212039c8b4b

Changes

diff --git a/tests/test_macrodown.cpp b/tests/test_macrodown.cpp
index c080cae..2c58235 100644
--- a/tests/test_macrodown.cpp
+++ b/tests/test_macrodown.cpp
@@ -59,4 +59,14 @@ TEST(MacroDownTest, MixedContent)
     std::string input = "# Header\n\nParagraph with *em* and %code{macros}.";
     std::string expected = "<h1>Header</h1>\n<p>Paragraph with <em>em</em> and <code>macros</code>.</p>\n";
     EXPECT_EQ(md.render(*md.parse(input)), expected);
+}
+
+TEST(MacroDownTest, InlineDefinition)
+{
+    MacroDown md;
+    std::string input = "%def[bold]{t}{<b>%t</b>}\n\nThis is %bold{important}.";
+    // The first paragraph only contains the definition, which evaluates to empty string.
+    // The second paragraph uses the newly defined macro.
+    std::string expected = "<p>This is <b>important</b>.</p>\n";
+    EXPECT_EQ(md.render(*md.parse(input)), expected);
 }
\ No newline at end of file