From bcc4adb7cce878694cb8f9b56be60ed38afe8133 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Mon, 20 Apr 2015 00:30:13 -0700 Subject: [PATCH] Fix #127 --- src/dfmt/formatter.d | 2 ++ tests/allman/issue0127.d.ref | 4 ++++ tests/issue0127.d | 4 ++++ tests/otbs/issue0127.d.ref | 4 ++++ tests/test | 4 +++- 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/allman/issue0127.d.ref create mode 100644 tests/issue0127.d create mode 100644 tests/otbs/issue0127.d.ref diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 608c384..8c01e34 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -474,6 +474,8 @@ private: { writeToken(); linebreakHints = []; + while (indents.topIs(tok!"enum")) + indents.pop(); newline(); } } diff --git a/tests/allman/issue0127.d.ref b/tests/allman/issue0127.d.ref new file mode 100644 index 0000000..a6b95af --- /dev/null +++ b/tests/allman/issue0127.d.ref @@ -0,0 +1,4 @@ +version (Windows) + enum root = `C:\`; +else + enum root = "/"; diff --git a/tests/issue0127.d b/tests/issue0127.d new file mode 100644 index 0000000..6265a81 --- /dev/null +++ b/tests/issue0127.d @@ -0,0 +1,4 @@ +version (Windows) + enum root = `C:\`; +else + enum root = "/"; diff --git a/tests/otbs/issue0127.d.ref b/tests/otbs/issue0127.d.ref new file mode 100644 index 0000000..a6b95af --- /dev/null +++ b/tests/otbs/issue0127.d.ref @@ -0,0 +1,4 @@ +version (Windows) + enum root = `C:\`; +else + enum root = "/"; diff --git a/tests/test b/tests/test index 5c66bf9..7f11c5a 100755 --- a/tests/test +++ b/tests/test @@ -6,9 +6,11 @@ do for source in *.d do echo "${source}.ref" "${braceStyle}/${source}.out" - argsFile=$(basename ${source}).args + argsFile=$(basename ${source} .d).args if [ -e ${argsFile} ]; then args=$(cat ${argsFile}) + else + args= fi ../bin/dfmt --brace_style=${braceStyle} ${args} "${source}" > "${braceStyle}/${source}.out" diff -u "${braceStyle}/${source}.ref" "${braceStyle}/${source}.out"