There's a bug in the WhitespaceManager that prevents correct alignment when using tab.
This patch fix a test condition that was triggering the bug and add missing unit tests that would have failed.
The issue can be seen by invoking clang-format on this simple snippet with -style="{BasedOnStyle: llvm, UseTab: Always, AlignConsecutiveAssignments: true, AlignConsecutiveDeclarations: true, TabWidth: 4}"
int a = 42; int aa = 42; int aaa = 42; int aaaa = 42;
Displaying the result in a editor with a tabsize of 4, the first = won't be aligned correctly.
The logic in WhitespaceManager::appendIndentText treats the first tab as a special case, which is what must be done in order to handle tabstop correctly.
However, handling the first tab is done conditionally using the first tab width.
The proposed fix is to handle the first tab independently of its size as the code that follow this test...
Text.append(Spaces / Style.TabWidth, '\t');
...will only work if the '\t' we're adding are positionned on a tabstop (so '\t' is equal to TabWidth in the output, otherwise it will be between 1 and TabWidth - 1)
Why is this not just if (FirstTabWidth <= Spaces) then?