summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-11-18 17:53:35 +0900
committerMichele Calgaro <[email protected]>2023-11-19 19:27:29 +0900
commitc0a6f1b84c84749908961579b84513fd9f9d9eac (patch)
treeace7ba60cb031acd3a1f4ff10f7bbc5668fa801f /debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp
parent52e5ffe140f0f4402e97936447bc9a606045d2b5 (diff)
downloadextra-dependencies-c0a6f1b84c84749908961579b84513fd9f9d9eac.tar.gz
extra-dependencies-c0a6f1b84c84749908961579b84513fd9f9d9eac.zip
uncrustify-trinity: updated based on upstream version 0.78.0
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp213
1 files changed, 213 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp
new file mode 100644
index 00000000..9a4a03d5
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.78.0/tests/input/cpp/issue_3116.cpp
@@ -0,0 +1,213 @@
+// Singular with various newline formats
+auto f = [] -> void {
+ return;
+};
+
+auto f = [] -> void {
+ return;
+}();
+
+auto f = [] -> void
+{
+ return;
+}();
+
+auto f =
+[] -> void {
+ return;
+};
+
+auto f =
+[] -> void
+{
+ return;
+};
+
+auto f
+ = [] -> void {
+ int i = 0;
+ return;
+ };
+
+auto f
+ = []
+ {
+ int i = 0;
+ return;
+ };
+
+// Nested lambda
+auto f = [] {
+ auto g = [] {
+ auto h = [] {
+ return;
+ };
+ return;
+ };
+ return;
+};
+
+auto f = [] {
+ auto g = []
+ {
+ auto h = [] {
+ return;
+ };
+ return;
+ };
+ return;
+};
+
+auto f = []
+{
+ auto g = [] {
+ auto h = []
+ {
+ return;
+ };
+ return;
+ };
+ return;
+};
+
+// Nested lambda within functions
+FuncA(
+ [] { return; },
+ [] { return; }
+);
+
+FuncB([] { return; },
+ [] { return; }
+);
+
+FuncC([] { return; },
+ [] { return; }
+)();
+
+FuncD([] { return; },
+ [] { return; })();
+
+FuncE([] { return; },
+ [] { return; });
+
+A(
+ B([] (const std::string &s) -> bool {
+ s = "hello";
+ return true;
+ }), 1
+ );
+
+A(
+ B(
+ [] (const std::string &s) -> bool {
+ s = "hello";
+ return true;
+ }
+ ), 1
+ );
+
+// Inside scope
+{
+ std::thread([](const char *c) {
+ std::cout << c << std::endl;
+ }).detach();
+
+ std::thread(
+ [](const char *c) {
+ std::cout << c << std::endl;
+ }
+ ).detach();
+
+ auto f = [&](int a) {
+ return b;
+ };
+
+ auto f = [&](int a)
+ {
+ return b;
+ };
+}
+
+Func(std::count_if(v.begin(), v.end(), [&](const auto &a) {
+ return a == 3;
+ }));
+
+Func(
+ std::count_if(v.begin(), v.end(), [&](const auto &a)
+ {
+ return a == 3;
+ }));
+
+Func(
+ std::count_if(v.begin(), v.end(), [&](const auto &a) {
+ return a == 3;
+ }));
+
+Func(
+ std::count_if(v.begin(), v.end(), [&](const auto &a) {
+ return a == 3;
+ })
+ );
+
+// Test case from issue #3116
+const auto compare = [] (const auto i, const auto j)
+{
+ return i >= j;
+};
+
+std::sort(
+ vector.begin(),
+ vector.end(),
+ [] (const auto i, const auto j)
+{
+ return i >= j;
+}
+);
+
+// Test case from issue #3116
+if(isWidgetOfCurrentRow)
+{
+ it = std::find_if(
+ reloaded.begin(),
+ reloaded.end(),
+ [&rowGuid](const auto& device)
+ {
+ return (device.thingGUID == rowGuid && !device.isWidget);
+ }
+ );
+}
+else
+{
+ it = std::find_if(
+ reloaded.begin(),
+ reloaded.end(),
+ [&rowGuid](const auto& device)
+ {
+ return device.thingGUID == rowGuid;
+ }
+ );
+}
+
+// Test case from issue 1296 and some variants
+obj->Func([&](int a)
+ {
+ return b;
+ });
+
+obj->Func([] -> int
+ {
+ return b;
+ });
+
+obj->Func([]
+ {
+ return b;
+ }
+ );
+
+obj->Func(
+ Func([]
+ {
+ return b;
+ })
+ );