-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc++][format] Improves tests. #76291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tests the returned type. This was first done for the vector<bool> formatters. This adds it to the other formatters where it wasn't done yet.
@llvm/pr-subscribers-libcxx Author: Mark de Wever (mordante) ChangesTests the returned type. This was first done for the vector<bool> formatters. This adds it to the other formatters where it wasn't done yet. Full diff: https://github.com/llvm/llvm-project/pull/76291.diff 10 Files Affected:
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
index d326b2b2f85ad5..efea2889ce3b5a 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
@@ -37,7 +37,7 @@ void test(StringT expected, StringViewT fmt, bool arg, std::size_t offset) {
std::formatter<bool, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
index 6d7fd1b2ad8758..f363bc3032003c 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
@@ -37,7 +37,7 @@ void test(StringT expected, StringViewT fmt, const CharT* a, std::size_t offset)
std::formatter<T, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
index 0b74ebba6e7df8..554def930020a9 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp
@@ -38,7 +38,7 @@ void test(StringT expected, StringViewT fmt, ArgumentT arg, std::size_t offset)
std::formatter<ArgumentT, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
index 7c1e1c076bfbfd..295ba7f67bbc5b 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp
@@ -50,7 +50,7 @@ struct Tester {
std::formatter<Str, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename std::basic_string_view<CharT>::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
std::basic_string<CharT> result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
index 2df78344772911..206b0214cf5fd7 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
@@ -48,7 +48,7 @@ void test(std::basic_string_view<CharT> fmt, ArithmeticT arg, std::basic_string<
std::formatter<ArithmeticT, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename std::basic_string_view<CharT>::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
std::basic_string<CharT> result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
index 8fb4ebe57cdb78..e2b3d6b3d23701 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
@@ -42,7 +42,7 @@ void test(std::string expected, std::string_view fmt, color arg, std::size_t off
std::formatter<color, char> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename std::string_view::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
std::string result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
index ff5bfe0fb472a2..aa10f34c95b796 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
@@ -43,7 +43,7 @@ void test(StringT expected, StringViewT fmt, PointerT arg, std::size_t offset) {
std::formatter<PointerT, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
index 6f827ef5983278..e5db5dac0c569d 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp
@@ -45,7 +45,7 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset
std::formatter<ArithmeticT, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
index e99deb2db55300..73df7464dcb7a7 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
@@ -45,7 +45,7 @@ void test(StringT expected, StringViewT fmt, StringT a, std::size_t offset) {
std::formatter<T, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
diff --git a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
index 2a412eaa368a3f..eb70115bf5de59 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp
@@ -45,7 +45,7 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg, std::size_t offset
std::formatter<ArithmeticT, CharT> formatter;
static_assert(std::semiregular<decltype(formatter)>);
- auto it = formatter.parse(parse_ctx);
+ std::same_as<typename StringViewT::iterator> auto it = formatter.parse(parse_ctx);
assert(it == fmt.end() - offset);
StringT result;
|
ldionne
approved these changes
Jan 30, 2024
agozillon
pushed a commit
to agozillon/llvm-project
that referenced
this pull request
Feb 5, 2024
Tests the returned type. This was first done for the vector<bool> formatters. This adds it to the other formatters where it wasn't done yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests the returned type. This was first done for the vector formatters. This adds it to the other formatters where it wasn't done yet.