From 3e5307f0819bbd33d5038b4901c5ed07286f7f0f Mon Sep 17 00:00:00 2001 From: Hackerpilot <briancschott@gmail.com> Date: Thu, 14 Jan 2016 14:40:16 -0800 Subject: [PATCH] Fix #206 --- src/dfmt/formatter.d | 2 ++ tests/allman/issue0206.d.ref | 8 ++++++++ tests/issue0206.d | 8 ++++++++ tests/otbs/issue0206.d.ref | 7 +++++++ 4 files changed, 25 insertions(+) create mode 100644 tests/allman/issue0206.d.ref create mode 100644 tests/issue0206.d create mode 100644 tests/otbs/issue0206.d.ref diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 3315aa8..36de9c9 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -380,6 +380,8 @@ private: { break; } + else if (currentIs(tok!"{") && config.dfmt_brace_style == BraceStyle.allman) + break; else if (t == tok!"import" && !currentIs(tok!"import") && !currentIs(tok!"}") && !(currentIs(tok!"public") && peekIs(tok!"import"))) diff --git a/tests/allman/issue0206.d.ref b/tests/allman/issue0206.d.ref new file mode 100644 index 0000000..b30fc9b --- /dev/null +++ b/tests/allman/issue0206.d.ref @@ -0,0 +1,8 @@ +unittest +{ + import std.stdio : stderr; + + { + a = 10; + } +} diff --git a/tests/issue0206.d b/tests/issue0206.d new file mode 100644 index 0000000..91965e1 --- /dev/null +++ b/tests/issue0206.d @@ -0,0 +1,8 @@ +unittest +{ + import std.stdio : stderr; + + { + a = 10; + } +} diff --git a/tests/otbs/issue0206.d.ref b/tests/otbs/issue0206.d.ref new file mode 100644 index 0000000..b0ec36a --- /dev/null +++ b/tests/otbs/issue0206.d.ref @@ -0,0 +1,7 @@ +unittest { + import std.stdio : stderr; + + { + a = 10; + } +}