[libcxx-commits] [libcxx] bc21af6 - [NFC][libc++][test] Improves code reuse.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 10 09:50:04 PST 2023


Author: Mark de Wever
Date: 2023-01-10T18:49:58+01:00
New Revision: bc21af6a43db45bf0d0192afab0a079ecf400aa2

URL: https://github.com/llvm/llvm-project/commit/bc21af6a43db45bf0d0192afab0a079ecf400aa2
DIFF: https://github.com/llvm/llvm-project/commit/bc21af6a43db45bf0d0192afab0a079ecf400aa2.diff

LOG: [NFC][libc++][test] Improves code reuse.

This applies D140115 to the new tuple tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D140650

Added: 
    

Modified: 
    libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
    libcxx/test/support/format.functions.common.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h b/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
index 159a617234a51..64d3ce4dedd6e 100644
--- a/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
+++ b/libcxx/test/std/utilities/format/format.tuple/format.functions.tests.h
@@ -11,28 +11,7 @@
 #include <concepts>
 #include <format>
 
-#include "make_string.h"
-
-#define STR(S) MAKE_STRING(CharT, S)
-#define SV(S) MAKE_STRING_VIEW(CharT, S)
-
-template <class T>
-struct context {};
-
-template <>
-struct context<char> {
-  using type = std::format_context;
-};
-
-#ifndef TEST_HAS_NO_WIDE_CHARACTERS
-template <>
-struct context<wchar_t> {
-  using type = std::wformat_context;
-};
-#endif
-
-template <class T>
-using context_t = typename context<T>::type;
+#include "format.functions.common.h"
 
 enum class color { black, red, gold };
 

diff  --git a/libcxx/test/support/format.functions.common.h b/libcxx/test/support/format.functions.common.h
index fa107ba5dc44a..14faf3acd0d5d 100644
--- a/libcxx/test/support/format.functions.common.h
+++ b/libcxx/test/support/format.functions.common.h
@@ -10,6 +10,8 @@
 
 // Contains the common part of the formatter tests for 
diff erent papers.
 
+#include <algorithm>
+#include <charconv>
 #include <format>
 
 #include "make_string.h"


        


More information about the libcxx-commits mailing list