This commit is contained in:
Karl Seguin
2025-02-01 15:38:08 +08:00
parent fc0ec860b0
commit 3d66758507
2 changed files with 12 additions and 27 deletions

View File

@@ -157,34 +157,20 @@ fn writeEscapedAttributeValue(writer: anytype, value: []const u8) !void {
const testing = std.testing; const testing = std.testing;
test "dump.writeHTML" { test "dump.writeHTML" {
try testWriteHTML( try testWriteHTML("<div id=\"content\">Over 9000!</div>", "<div id=\"content\">Over 9000!</div>");
"<div id=\"content\">Over 9000!</div>",
"<div id=\"content\">Over 9000!</div>"
);
try testWriteHTML( try testWriteHTML("<root><!-- a comment --></root>", "<root><!-- a comment --></root>");
"<root><!-- a comment --></root>",
"<root><!-- a comment --></root>"
);
try testWriteHTML( try testWriteHTML("<p>&lt; &gt; &amp;</p>", "<p>&lt; &gt; &amp;</p>");
"<p>&lt; &gt; &amp;</p>",
"<p>&lt; &gt; &amp;</p>"
);
try testWriteHTML( try testWriteHTML("<p id=\"&quot;&gt;&lt;&amp;&quot;''\">wat?</p>", "<p id='\">&lt;&amp;&quot;&#39;&apos;'>wat?</p>");
"<p id=\"&quot;&gt;&lt;&amp;&quot;''\">wat?</p>",
"<p id='\">&lt;&amp;&quot;&#39;&apos;'>wat?</p>"
);
try testWriteFullHTML( try testWriteFullHTML(
\\<!DOCTYPE html> \\<!DOCTYPE html>
\\<html><head><title>It's over what?</title><meta name="a" value="b"> \\<html><head><title>It's over what?</title><meta name="a" value="b">
\\</head><body>9000</body></html> \\</head><body>9000</body></html>
\\ \\
, , "<html><title>It's over what?</title><meta name=a value=\"b\">\n<body>9000");
"<html><title>It's over what?</title><meta name=a value=\"b\">\n<body>9000"
);
} }
fn testWriteHTML(comptime expected: []const u8, src: []const u8) !void { fn testWriteHTML(comptime expected: []const u8, src: []const u8) !void {

View File

@@ -185,8 +185,7 @@ test "generate.Union" {
} }
test "generate.Tuple" { test "generate.Tuple" {
const Astruct = struct { const Astruct = struct {};
};
const Bstruct = struct { const Bstruct = struct {
value: u8 = 0, value: u8 = 0,