Skip to content

Commit c0ac3c1

Browse files
committed
[NFC][libc++][test] Uses public functions.
Replaces std::__format_context_create with the public wrapper test_format_context_create. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D133781
1 parent f8fa042 commit c0ac3c1

12 files changed

+34
-17
lines changed

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <concepts>
2525
#include <type_traits>
2626

27+
#include "test_format_context.h"
2728
#include "test_macros.h"
2829
#include "make_string.h"
2930

@@ -43,8 +44,8 @@ void test(StringT expected, StringViewT fmt, bool arg) {
4344
auto out = std::back_inserter(result);
4445
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
4546

46-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
47-
out, std::make_format_args<FormatCtxT>(arg));
47+
std::basic_format_context format_ctx =
48+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
4849
formatter.format(arg, format_ctx);
4950
assert(result == expected);
5051
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <concepts>
2323
#include <type_traits>
2424

25+
#include "test_format_context.h"
2526
#include "test_macros.h"
2627
#include "make_string.h"
2728

@@ -42,8 +43,8 @@ void test(StringT expected, StringViewT fmt, const CharT* a) {
4243
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
4344

4445
auto* arg = const_cast<T>(a);
45-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
46-
out, std::make_format_args<FormatCtxT>(arg));
46+
std::basic_format_context format_ctx =
47+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
4748
formatter.format(arg, format_ctx);
4849
assert(result == expected);
4950
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <concepts>
2424
#include <type_traits>
2525

26+
#include "test_format_context.h"
2627
#include "test_macros.h"
2728
#include "make_string.h"
2829

@@ -42,8 +43,8 @@ void test(StringT expected, StringViewT fmt, ArgumentT arg) {
4243
auto out = std::back_inserter(result);
4344
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
4445

45-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
46-
out, std::make_format_args<FormatCtxT>(arg));
46+
std::basic_format_context format_ctx =
47+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
4748
formatter.format(arg, format_ctx);
4849
assert(result == expected);
4950
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.char_array.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <concepts>
2323
#include <type_traits>
2424

25+
#include "test_format_context.h"
2526
#include "test_macros.h"
2627
#include "make_string.h"
2728

@@ -57,7 +58,8 @@ struct Tester {
5758
// Note not too found of this hack
5859
Str* data = reinterpret_cast<Str*>(const_cast<CharT*>(buffer.c_str()));
5960

60-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(*data));
61+
std::basic_format_context format_ctx =
62+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(*data));
6163
formatter.format(*data, format_ctx);
6264
assert(result == expected);
6365
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.const_char_array.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <concepts>
2424
#include <type_traits>
2525

26+
#include "test_format_context.h"
2627
#include "test_macros.h"
2728
#include "make_string.h"
2829

@@ -59,8 +60,8 @@ struct Tester {
5960
// Note not too found of this hack
6061
Str* data = reinterpret_cast<Str*>(buffer.c_str());
6162

62-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
63-
out, std::make_format_args<FormatCtxT>(*data));
63+
std::basic_format_context format_ctx =
64+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(*data));
6465
formatter.format(*data, format_ctx);
6566
assert(result == expected);
6667
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <string>
3535
#include <type_traits>
3636

37+
#include "test_format_context.h"
3738
#include "test_macros.h"
3839
#include "make_string.h"
3940

@@ -52,7 +53,8 @@ void test(std::basic_string_view<CharT> fmt, ArithmeticT arg, std::basic_string<
5253
auto out = std::back_inserter(result);
5354
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
5455

55-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
56+
std::basic_format_context format_ctx =
57+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
5658
formatter.format(arg, format_ctx);
5759

5860
if (expected.empty()) {

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <string>
2525
#include <type_traits>
2626

27+
#include "test_format_context.h"
2728
#include "test_macros.h"
2829

2930
enum class color { black, red, gold };
@@ -46,7 +47,8 @@ void test(std::string expected, std::string_view fmt, color arg) {
4647
auto out = std::back_inserter(result);
4748
using FormatCtxT = std::basic_format_context<decltype(out), char>;
4849

49-
auto format_ctx = std::__format_context_create<decltype(out), char>(out, std::make_format_args<FormatCtxT>(arg));
50+
std::basic_format_context format_ctx =
51+
test_format_context_create<decltype(out), char>(out, std::make_format_args<FormatCtxT>(arg));
5052
formatter.format(arg, format_ctx);
5153
assert(result == expected);
5254
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <string>
3030
#include <type_traits>
3131

32+
#include "test_format_context.h"
3233
#include "test_macros.h"
3334
#include "make_string.h"
3435

@@ -48,7 +49,8 @@ void test(StringT expected, StringViewT fmt, PointerT arg) {
4849
auto out = std::back_inserter(result);
4950
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
5051

51-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
52+
std::basic_format_context format_ctx =
53+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
5254
formatter.format(arg, format_ctx);
5355

5456
if (expected.empty()) {

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.signed_integral.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <concepts>
3232
#include <type_traits>
3333

34+
#include "test_format_context.h"
3435
#include "test_macros.h"
3536
#include "make_string.h"
3637

@@ -50,8 +51,8 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg) {
5051
auto out = std::back_inserter(result);
5152
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
5253

53-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
54-
out, std::make_format_args<FormatCtxT>(arg));
54+
std::basic_format_context format_ctx =
55+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
5556
formatter.format(arg, format_ctx);
5657
assert(result == expected);
5758
}

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <concepts>
2525
#include <type_traits>
2626

27+
#include "test_format_context.h"
2728
#include "test_macros.h"
2829
#include "make_string.h"
2930

@@ -50,7 +51,7 @@ void test(StringT expected, StringViewT fmt, StringT a) {
5051
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
5152

5253
ArgumentT arg = a;
53-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
54+
std::basic_format_context format_ctx = test_format_context_create<decltype(out), CharT>(
5455
out, std::make_format_args<FormatCtxT>(std::forward<ArgumentT>(arg)));
5556
formatter.format(arg, format_ctx);
5657
assert(result == expected);

libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.unsigned_integral.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <concepts>
3232
#include <type_traits>
3333

34+
#include "test_format_context.h"
3435
#include "test_macros.h"
3536
#include "make_string.h"
3637

@@ -50,8 +51,8 @@ void test(StringT expected, StringViewT fmt, ArithmeticT arg) {
5051
auto out = std::back_inserter(result);
5152
using FormatCtxT = std::basic_format_context<decltype(out), CharT>;
5253

53-
auto format_ctx = std::__format_context_create<decltype(out), CharT>(
54-
out, std::make_format_args<FormatCtxT>(arg));
54+
std::basic_format_context format_ctx =
55+
test_format_context_create<decltype(out), CharT>(out, std::make_format_args<FormatCtxT>(arg));
5556
formatter.format(arg, format_ctx);
5657
assert(result == expected);
5758
}

libcxx/test/support/test_format_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* this file.
2525
*/
2626

27+
#include "test_macros.h"
28+
2729
#if TEST_STD_VER < 20
2830
#error "The format header requires at least C++20"
2931
#endif

0 commit comments

Comments
 (0)