Skip to content

Commit

Permalink
Fix #88
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Mar 10, 2015
1 parent 66342a9 commit 52eabd4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dfmt.d
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,13 @@ private:
case tok!"in":
case tok!"is":
writeToken();
if (!currentIs(tok!"("))
if (!currentIs(tok!"(") && !currentIs(tok!"{"))
write(" ");
break;
case tok!"case":
writeToken();
write(" ");
break;
default:
if (index + 1 < tokens.length)
{
Expand Down
9 changes: 9 additions & 0 deletions tests/issue0088.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
unittest
{
switch (x)
{
case+1:
case-1:
case(1):
}
}
9 changes: 9 additions & 0 deletions tests/issue0088.d.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
unittest
{
switch (x)
{
case +1:
case -1:
case (1):
}
}

0 comments on commit 52eabd4

Please sign in to comment.