From d33b87896500f9b85b134f2d391e5e9070c9925d Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Nov 2019 16:34:58 +0100 Subject: [PATCH 1/5] fix #430 already working resolved with previous libdparse update --- tests/allman/issue0430.d.ref | 6 ++++++ tests/issue0430.d | 4 ++++ tests/otbs/issue0430.d.ref | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 tests/allman/issue0430.d.ref create mode 100644 tests/issue0430.d create mode 100644 tests/otbs/issue0430.d.ref diff --git a/tests/allman/issue0430.d.ref b/tests/allman/issue0430.d.ref new file mode 100644 index 0000000..ea6b044 --- /dev/null +++ b/tests/allman/issue0430.d.ref @@ -0,0 +1,6 @@ +void f(bool body) +{ + if (body) + { + } +} diff --git a/tests/issue0430.d b/tests/issue0430.d new file mode 100644 index 0000000..f8acf72 --- /dev/null +++ b/tests/issue0430.d @@ -0,0 +1,4 @@ +void f(bool body) { + if (body) { + } +} \ No newline at end of file diff --git a/tests/otbs/issue0430.d.ref b/tests/otbs/issue0430.d.ref new file mode 100644 index 0000000..ce11f55 --- /dev/null +++ b/tests/otbs/issue0430.d.ref @@ -0,0 +1,4 @@ +void f(bool body) { + if (body) { + } +} From 28b32d9d77683131f15a7b72917014ee9abe4144 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Nov 2019 16:41:12 +0100 Subject: [PATCH 2/5] trivially fix #134 was fixed in the past --- tests/allman/issue0134.d.ref | 15 +++++++++++++++ tests/issue0134.d | 11 +++++++++++ tests/otbs/issue0134.d.ref | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/allman/issue0134.d.ref create mode 100644 tests/issue0134.d create mode 100644 tests/otbs/issue0134.d.ref diff --git a/tests/allman/issue0134.d.ref b/tests/allman/issue0134.d.ref new file mode 100644 index 0000000..fbc72c0 --- /dev/null +++ b/tests/allman/issue0134.d.ref @@ -0,0 +1,15 @@ +void foo() +{ + string command; + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + + unittest + { + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + } +} diff --git a/tests/issue0134.d b/tests/issue0134.d new file mode 100644 index 0000000..8b57f0e --- /dev/null +++ b/tests/issue0134.d @@ -0,0 +1,11 @@ +void foo() { + string command; + version (Posix) command ~= " 2> /dev/null 1> /dev/null"; + + version (Posix) command ~= " 2> /dev/null 1> /dev/null"; + + unittest + { + version (Posix) command ~= " 2> /dev/null 1> /dev/null"; + } +} diff --git a/tests/otbs/issue0134.d.ref b/tests/otbs/issue0134.d.ref new file mode 100644 index 0000000..4e2c535 --- /dev/null +++ b/tests/otbs/issue0134.d.ref @@ -0,0 +1,13 @@ +void foo() { + string command; + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + + unittest { + version (Posix) + command ~= " 2> /dev/null 1> /dev/null"; + } +} From 79ae2c09d0b86a3d9a561c1fbf4eb4745df535ad Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Nov 2019 16:45:46 +0100 Subject: [PATCH 3/5] trivially fix #195 probably fixed in previous libdparse --- tests/allman/issue0195.d.ref | 16 ++++++++++++++++ tests/issue0195.d | 17 +++++++++++++++++ tests/otbs/issue0195.d.ref | 14 ++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/allman/issue0195.d.ref create mode 100644 tests/issue0195.d create mode 100644 tests/otbs/issue0195.d.ref diff --git a/tests/allman/issue0195.d.ref b/tests/allman/issue0195.d.ref new file mode 100644 index 0000000..b638abf --- /dev/null +++ b/tests/allman/issue0195.d.ref @@ -0,0 +1,16 @@ +void main() +{ + auto myTid = runTask({ + auto conn = connectTCP("localhost", 4222); + + auto l = Lexer(conn); + foreach (t; l) + { + + } + conn.close(); + }); + + // foo + runEventLoop(); +} diff --git a/tests/issue0195.d b/tests/issue0195.d new file mode 100644 index 0000000..f92a7ef --- /dev/null +++ b/tests/issue0195.d @@ -0,0 +1,17 @@ +void main() +{ + auto myTid = runTask({ + auto conn = connectTCP("localhost", 4222); + + auto l = Lexer(conn); + foreach (t; + l) + { + + } + conn.close(); + }); + + // foo + runEventLoop(); +} diff --git a/tests/otbs/issue0195.d.ref b/tests/otbs/issue0195.d.ref new file mode 100644 index 0000000..85955a0 --- /dev/null +++ b/tests/otbs/issue0195.d.ref @@ -0,0 +1,14 @@ +void main() { + auto myTid = runTask({ + auto conn = connectTCP("localhost", 4222); + + auto l = Lexer(conn); + foreach (t; l) { + + } + conn.close(); + }); + + // foo + runEventLoop(); +} From 70bae7487e5c7be0eda3899ba77b9e7dbb53a371 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Nov 2019 16:51:25 +0100 Subject: [PATCH 4/5] add dub build to readme fix #234 --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b28fa6e..130df61 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,7 @@ **dfmt** is beta quality. Make backups of your files or use source control when using the **--inplace** option. -## Building -### Using Make -* Clone the repository -* Run ```git submodule update --init --recursive``` in the dfmt directory -* To compile with DMD, run ```make``` in the dfmt directory. To compile with - LDC, run ```make ldc``` instead. The generated binary will be placed in ```dfmt/bin/```. +## Installation ### Installing with DUB @@ -18,6 +13,16 @@ when using the **--inplace** option. > dub fetch --version='~master' dfmt && dub run dfmt -- -h ``` +### Building from source using Make +* Clone the repository +* Run ```git submodule update --init --recursive``` in the dfmt directory +* To compile with DMD, run ```make``` in the dfmt directory. To compile with + LDC, run ```make ldc``` instead. The generated binary will be placed in ```dfmt/bin/```. + +### Building from source using dub +* Clone the repository +* run `dub build --build=release`, optionally with `--compiler=ldc2` + ## Using By default, dfmt reads its input from **stdin** and writes to **stdout**. If a file name is specified on the command line, input will be read from the From 8c2076d4f203b396fd23a3bcd8d2b4c0f657ecf1 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Nov 2019 17:10:20 +0100 Subject: [PATCH 5/5] better gen_expected script --- tests/gen_expected.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/gen_expected.sh b/tests/gen_expected.sh index a5520f7..b49ae4a 100755 --- a/tests/gen_expected.sh +++ b/tests/gen_expected.sh @@ -1,10 +1,12 @@ +#!/usr/bin/env bash + argsFile=$1.args if [ -e ${argsFile} ]; then args=$(cat ${argsFile}) fi echo "Args:" ${args} -dfmt --brace_style=allman ${args} $1.d > allman/$1.d.ref -dfmt --brace_style=otbs ${args} $1.d > otbs/$1.d.ref +../bin/dfmt --brace_style=allman ${args} $1.d > allman/$1.d.ref +../bin/dfmt --brace_style=otbs ${args} $1.d > otbs/$1.d.ref echo "------------------" echo "allman:"