From ac6a3d068d234793debf0b210dcffdfcfd928fd9 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Thu, 17 Jun 2021 13:18:36 +0430 Subject: [PATCH] AK: Add some tests for hexdump formatting --- Tests/AK/TestFormat.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/AK/TestFormat.cpp b/Tests/AK/TestFormat.cpp index 266185a9d91..9e0aad78100 100644 --- a/Tests/AK/TestFormat.cpp +++ b/Tests/AK/TestFormat.cpp @@ -289,3 +289,11 @@ TEST_CASE(long_long_regression) EXPECT_EQ(builder.string_view(), "81985529216486895"); } + +TEST_CASE(hex_dump) +{ + EXPECT_EQ(String::formatted("{:hex-dump}", "0000"), "30303030"); + EXPECT_EQ(String::formatted("{:>4hex-dump}", "0000"), "30303030 0000"); + EXPECT_EQ(String::formatted("{:>2hex-dump}", "0000"), "3030 00\n3030 00"); + EXPECT_EQ(String::formatted("{:*>4hex-dump}", "0000"), "30303030****0000"); +}