Skip to content

Regression on PR 31 for switch case #36

Closed

Description

@Rassi

PR 31 introduced regressions for switch case statements, not indenting them.

#31 (comment)

Expected versus output diff:

diff --git "a/C:\\dev\\uncrustify\\tests\\output\\staging\\60037-UNI-29933.cs" "b/C:\\dev\\uncrustify\\tests\\results\\staging\\60037-UNI-29933.cs"
index e885605..559a9f7 100644
--- "a/C:\\dev\\uncrustify\\tests\\output\\staging\\60037-UNI-29933.cs"
+++ "b/C:\\dev\\uncrustify\\tests\\results\\staging\\60037-UNI-29933.cs"
@@ -1,27 +1,27 @@
 void Foo1()
 {
     switch (foo)
     {
         case 1:
             _bar = new Bar(x, y,
-                z, a);
+            z, a);
             break;
         case 2:
             _bar = new Bar(x, y,
-                z, a);
+            z, a);
             break;
         case 3:
             _bar = foo.bar;
             break;
         case 4:
             foo.bar = Bar.BarFunc(x, (x == y)
-                ? foo.x
-                : foo.y);
+            ? foo.x
+            : foo.y);
             break;
         case 5:
             foo.bar = Bar.BarFunc(x, (x == y)
-                ? foo.x
-                : foo.y);
+            ? foo.x
+            : foo.y);
             break;
     }
 }

Debug support files:

60037-UNI-29933.cs
60037-UNI-29933.cs.log
60037-UNI-29933.cs.unc
UNI-29933.cfg
UNI-29933.cs

Disclaimer:

Note: This is a generated issue from our internal issue tracker.
Expect a dry description which could be insufficient to properly understand the issue.
On the other hand, the support files should be sufficient to easily reproduce and debug the issue,
but please comment if it's still unclear and I will get back with clarifications.
See main discussion thread here uncrustify#1223.

Activity

  1. spuppala-rythmos commented on Nov 1, 2017

    @spuppala-rythmos

    we checked out the code before the fix went into master and ran the test case with config mentioned above.
    we still see the issue and concluded that this is not a Regression on PR 31,
    hence it will be better if new issue is created for this in the upstream.

    Expected versus output diff before PR-31

    diff --git a/eop.txt b/op
    index f4ac1d93..fecc74df 100644
    --- a/eop.txt
    +++ b/op
    @@ -4,24 +4,24 @@ void Foo1()
         {
             case 1:
                 _bar = new Bar(x, y,
    -                z, a);
    +            z, a);^M
                 break;
             case 2:
                 _bar = new Bar(x, y,
    -                z, a);
    +            z, a);^M
                 break;
             case 3:
                 _bar = foo.bar;
                 break;
             case 4:
                 foo.bar = Bar.BarFunc(x, (x == y)
    -                ? foo.x
    -                : foo.y);
    +            ? foo.x^M
    +            : foo.y);^M
                 break;
             case 5:
                 foo.bar = Bar.BarFunc(x, (x == y)
    -                ? foo.x
    -                : foo.y);
    +            ? foo.x^M
    +            : foo.y);^M
                 break;
         }
     }
  2. added a commit that references this issue on Nov 1, 2017
    7c4b8af
  3. Rassi commented on Nov 1, 2017

    @Rassi
    Author

    You're right, it does produce the same diff. I looked into it, and it was missing a config option (indent_align_assign) which I've added and pushed to master (1b06004).

    Besides the regression (no indentation), I included only 1 level of indentation in the test, although it was previously 2 levels. So the test will still produce a diff before #31, but the test will be the correct expectation.

    It is related to the discussion we had on #38 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions