[libc-commits] [PATCH] D136965: [libc][obvious] fix scanf parser test

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 28 11:00:57 PDT 2022


michaelrj created this revision.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.

One of the expected values wasn't being initialized correctly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136965

Files:
  libc/test/src/stdio/scanf_core/parser_test.cpp


Index: libc/test/src/stdio/scanf_core/parser_test.cpp
===================================================================
--- libc/test/src/stdio/scanf_core/parser_test.cpp
+++ libc/test/src/stdio/scanf_core/parser_test.cpp
@@ -680,22 +680,20 @@
   EXPECT_SFORMAT_EQ(expected2, format_arr[2]);
 
   expected3.has_conv = true;
-
+  // "%%"
   expected3.raw_string = {str + 19, 2};
   expected3.conv_name = '%';
 
   EXPECT_SFORMAT_EQ(expected3, format_arr[3]);
 
   expected4.has_conv = false;
-
   // " "
   expected4.raw_string = {str + 21, 1};
 
   EXPECT_SFORMAT_EQ(expected4, format_arr[4]);
 
   expected5.has_conv = true;
-
-  // "%%"
+  // "%2$*f"
   expected5.raw_string = {str + 22, 5};
   expected5.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE;
   expected5.conv_name = 'f';
@@ -703,7 +701,6 @@
   EXPECT_SFORMAT_EQ(expected5, format_arr[5]);
 
   expected6.has_conv = false;
-
   // " "
   expected6.raw_string = {str + 27, 1};
 
@@ -711,7 +708,7 @@
 
   expected7.has_conv = true;
 
-  // "%2$*f"
+  // "%4$d"
   expected7.raw_string = {str + 28, 4};
   expected7.output_ptr = &arg4;
   expected7.conv_name = 'd';
@@ -719,14 +716,12 @@
   EXPECT_SFORMAT_EQ(expected7, format_arr[7]);
 
   expected8.has_conv = false;
-
   // " "
   expected8.raw_string = {str + 32, 1};
 
   EXPECT_SFORMAT_EQ(expected8, format_arr[8]);
 
   expected9.has_conv = true;
-
   // "%1$1c"
   expected9.raw_string = {str + 33, 5};
   expected9.max_width = 1;
@@ -735,8 +730,7 @@
 
   EXPECT_SFORMAT_EQ(expected9, format_arr[9]);
 
-  expected9.has_conv = true;
-
+  expected10.has_conv = true;
   // "%5$[123]"
   expected10.raw_string = {str + 38, 8};
   expected10.output_ptr = &arg5;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136965.471598.patch
Type: text/x-patch
Size: 1687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221028/30a31964/attachment.bin>


More information about the libc-commits mailing list