[libcxx-commits] [libcxx] [libc++][ranges][NFC] Format a couple of tests as a prerequisite to https://llvm.org/PR190513 (PR #190514)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 5 02:41:11 PDT 2026


https://github.com/H-G-Hristov created https://github.com/llvm/llvm-project/pull/190514

...to avoid friction.

>From 3c59f2d2b9d5d3594a570b4d5368b32342ad972f Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Sun, 5 Apr 2026 12:40:49 +0300
Subject: [PATCH] [libc++][ranges][NFC] Format a couple of tests as a
 prerequisite to https://llvm.org/PR190513

...to avoid friction.
---
 .../range.filter/ctor.view_pred.pass.cpp          |  4 ++--
 .../range.lazy.split/ctor.view.pass.cpp           | 15 ++++++---------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
index 3ccab93397147..8eaf6eba35709 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.filter/ctor.view_pred.pass.cpp
@@ -19,7 +19,7 @@
 #include "types.h"
 
 struct Range : std::ranges::view_base {
-  constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) { }
+  constexpr explicit Range(int* b, int* e) : begin_(b), end_(e) {}
   constexpr int* begin() const { return begin_; }
   constexpr int* end() const { return end_; }
 
@@ -52,7 +52,7 @@ static_assert(!test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pr
 
 #else
 
-static_assert( test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
+static_assert(test_convertible<std::ranges::filter_view<Range, Pred>, Range, Pred>(),
               "This constructor must not be explicit");
 
 #endif // TEST_STD_VER >= 23
diff --git a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
index e7bf052a7e9ee..46af5498d59a0 100644
--- a/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
+++ b/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ctor.view.pass.cpp
@@ -20,18 +20,15 @@
 
 struct ViewWithCounting : std::ranges::view_base {
   int* times_copied = nullptr;
-  int* times_moved = nullptr;
+  int* times_moved  = nullptr;
 
   constexpr ViewWithCounting(int& copies_ctr, int& moves_ctr) : times_copied(&copies_ctr), times_moved(&moves_ctr) {}
 
   constexpr ViewWithCounting(const ViewWithCounting& rhs)
-    : times_copied(rhs.times_copied)
-    , times_moved(rhs.times_moved) {
+      : times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
     ++(*times_copied);
   }
-  constexpr ViewWithCounting(ViewWithCounting&& rhs)
-    : times_copied(rhs.times_copied)
-    , times_moved(rhs.times_moved) {
+  constexpr ViewWithCounting(ViewWithCounting&& rhs) : times_copied(rhs.times_copied), times_moved(rhs.times_moved) {
     ++(*times_moved);
   }
 
@@ -39,14 +36,14 @@ struct ViewWithCounting : std::ranges::view_base {
   constexpr const char* end() const { return nullptr; }
 
   constexpr ViewWithCounting& operator=(const ViewWithCounting&) = default;
-  constexpr ViewWithCounting& operator=(ViewWithCounting&&) = default;
+  constexpr ViewWithCounting& operator=(ViewWithCounting&&)      = default;
   constexpr bool operator==(const ViewWithCounting&) const { return true; }
 };
 
 static_assert(std::ranges::forward_range<ViewWithCounting>);
 static_assert(std::ranges::view<ViewWithCounting>);
 
-using View = ViewWithCounting;
+using View    = ViewWithCounting;
 using Pattern = ViewWithCounting;
 
 // SFINAE tests.
@@ -58,7 +55,7 @@ static_assert(!test_convertible<std::ranges::lazy_split_view<View, Pattern>, Vie
 
 #else
 
-static_assert( test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
+static_assert(test_convertible<std::ranges::lazy_split_view<View, Pattern>, View, Pattern>(),
               "This constructor must not be explicit");
 
 #endif // TEST_STD_VER >= 23



More information about the libcxx-commits mailing list