summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-11-21 17:04:21 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-11-21 17:09:35 +0900
commite6ba08c3b21cdb14ee3a97b5d584759a4597b54b (patch)
treee8b4121323f2f448aeaa15bf3bddb465f36aea8b /debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp
parentf312c235ea5f9971066f3808997d20f89c25f33b (diff)
downloadextra-dependencies-e6ba08c3b21cdb14ee3a97b5d584759a4597b54b.tar.gz
extra-dependencies-e6ba08c3b21cdb14ee3a97b5d584759a4597b54b.zip
uncrustify-trinity: updated based on upstream version 0.74.0
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp')
-rw-r--r--debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp139
1 files changed, 139 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp
new file mode 100644
index 00000000..54684fa7
--- /dev/null
+++ b/debian/uncrustify-trinity/uncrustify-trinity-0.74.0/tests/input/cpp/indent_shift.cpp
@@ -0,0 +1,139 @@
+// We want simple 4-space indentation for each nesting "level".
+
+// cannot find a way to tell uncrustify to indent the line with parenthesis
+int case2() {
+
+ if (condition) {
+ // some code here
+ }
+
+ std::out <<
+ "hello " << "world " <<
+ (who ? "and " : "or ") <<
+ "all " <<
+ "others" << ";" << std::endl;
+
+ // and
+
+ if (condition) {
+ // some code here
+ }
+
+ std::out <<
+ "hello " << "world " <<
+ ("and ") <<
+ "all " <<
+ "others" << ";" << std::endl;
+
+ if (cond)
+ std::out << "hi";
+
+if (cond)
+std::out
+<< "hi"
+<< "and"
+<< "more"
+;
+
+switch (var) {
+ case 0:
+log() << 5
+<< 5;
+ break;
+}
+
+#if 0
+ out
+ << 5;
+#endif
+
+ return log
+ >> var
+ >> second
+ ;
+}
+
+
+// uncrustify aligns (with the << on the first line) instead of indenting
+void case3()
+{
+
+ if (condition1) {
+
+ if (condition2) {
+
+ std::out << "hello "
+ << "world "
+ << (who ? "and " : "or ")
+ << "all "
+ << "others" << ";" << std::endl;
+
+ }
+ }
+
+ // this often works better, but has problems with parentheses:
+
+ if (condition1) {
+ if (condition2) {
+ std::out << "hello " <<
+ "world " <<
+ (who ? "and " : "or ") <<
+ "all " <<
+ "others" << ";" << std::endl;
+ }
+ }
+}
+
+// uncrustify does not indent >> at all!
+void case4()
+{
+ if (condition) {
+ // some code here
+ }
+
+ std::in >> a
+ >> b
+ >> (who ? c : d) >>
+ >> e;
+
+ // and
+
+ if (condition1) {
+
+ if (condition2) {
+ std::in >> a >>
+ b >>
+ (who ? c : d) >>
+ e;
+ }
+ }
+}
+
+void foo() {
+
+ if (head())
+ os << "HEAD,";
+ else
+ if (tail())
+ os << "TAIL,";
+
+ if (a >= 0 &&
+ b <= 0)
+ cerr << "it is";
+}
+
+int list[] = {
+ 1,
+2,
+ 1 << 5,
+ 1 << 6
+};
+
+void check() {
+ ostream &os = Comment(1) << "error: " << workerName <<
+ " terminated by signal " << WTERMSIG(exitStatus);
+
+ return theAddr.addrN().family() == AF_INET6 ?
+ (theAddr.octet(idx * 2) << 8) + theAddr.octet(idx * 2 + 1) :
+ theAddr.octet(idx);
+}