From b776d5a9b96df283ab93b19a9bc689d633bdcb83 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Sat, 30 Oct 2021 19:43:31 +0200 Subject: [PATCH] Fix tests --- tests/knr/array_access.d.ref | 6 ++-- tests/knr/associative_array.d.ref | 36 +++++++++---------- tests/knr/associative_array_complex.d.ref | 40 ++++++++++----------- tests/knr/issue0451.d.ref | 37 +++++++++++++++++++ tests/knr/issue0528.d.ref | 3 ++ tests/knr/keep_break_in_array_chain.d.ref | 6 ++++ tests/knr/keep_single_indent.d.ref | 44 +++++++++++++++++++++++ tests/knr/single_indent.d.ref | 36 +++++++++++++++++++ 8 files changed, 167 insertions(+), 41 deletions(-) create mode 100644 tests/knr/issue0451.d.ref create mode 100644 tests/knr/issue0528.d.ref create mode 100644 tests/knr/keep_break_in_array_chain.d.ref create mode 100644 tests/knr/keep_single_indent.d.ref create mode 100644 tests/knr/single_indent.d.ref diff --git a/tests/knr/array_access.d.ref b/tests/knr/array_access.d.ref index 7a2ac55d..cf66c3da 100644 --- a/tests/knr/array_access.d.ref +++ b/tests/knr/array_access.d.ref @@ -1,6 +1,6 @@ unittest { foo([ - target.value.region[1], target.value.region[1], - target.value.region[1], target.value.region[1], target.value.region[1] - ]); + target.value.region[1], target.value.region[1], target.value.region[1], + target.value.region[1], target.value.region[1] + ]); } diff --git a/tests/knr/associative_array.d.ref b/tests/knr/associative_array.d.ref index 39f18c67..48442a31 100644 --- a/tests/knr/associative_array.d.ref +++ b/tests/knr/associative_array.d.ref @@ -1,23 +1,23 @@ unittest { Bson base = Bson([ - "maps": Bson([ - Bson(["id": Bson(4), "comment": Bson("hello")]), - Bson(["id": Bson(49), "comment": Bson(null)]) - ]), - "short": Bson(["a": "b", "c": "d"]), - "numbers": Bson([ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 - ]), - "shuffleOnReset": serializeToBson([ - "all": false, - "selected": true, - "maybe": false - ]), - "resetOnEmpty": Bson(false), - "applyMods": Bson(true), - "sendComments": Bson(true) - ]); + "maps": Bson([ + Bson(["id": Bson(4), "comment": Bson("hello")]), + Bson(["id": Bson(49), "comment": Bson(null)]) + ]), + "short": Bson(["a": "b", "c": "d"]), + "numbers": Bson([ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 0 + ]), + "shuffleOnReset": serializeToBson([ + "all": false, + "selected": true, + "maybe": false + ]), + "resetOnEmpty": Bson(false), + "applyMods": Bson(true), + "sendComments": Bson(true) + ]); int[] x = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 diff --git a/tests/knr/associative_array_complex.d.ref b/tests/knr/associative_array_complex.d.ref index c7b803bb..f637ca33 100644 --- a/tests/knr/associative_array_complex.d.ref +++ b/tests/knr/associative_array_complex.d.ref @@ -1,25 +1,25 @@ auto find() { return Map.findRange([ - "$and": [ - ["deleted": Bson(false)], - [ - "$or": Bson([ - serializeToBson(["forceUpdate": Bson(true)]), - serializeToBson([ - "info.approved": ["$eq": Bson(1)], - "fetchDate": [ - "$lte": Bson(BsonDate(currentTime - 60.days)) - ] - ]), - serializeToBson([ - "info.approved": ["$ne": Bson(1)], - "fetchDate": [ - "$lte": Bson(BsonDate(currentTime - 14.days)) - ] - ]) - ]) - ] + "$and": [ + ["deleted": Bson(false)], + [ + "$or": Bson([ + serializeToBson(["forceUpdate": Bson(true)]), + serializeToBson([ + "info.approved": ["$eq": Bson(1)], + "fetchDate": [ + "$lte": Bson(BsonDate(currentTime - 60.days)) + ] + ]), + serializeToBson([ + "info.approved": ["$ne": Bson(1)], + "fetchDate": [ + "$lte": Bson(BsonDate(currentTime - 14.days)) + ] + ]) + ]) ] - ]); + ] + ]); } diff --git a/tests/knr/issue0451.d.ref b/tests/knr/issue0451.d.ref new file mode 100644 index 00000000..fbd790f0 --- /dev/null +++ b/tests/knr/issue0451.d.ref @@ -0,0 +1,37 @@ +class C { + abstract void f1() // + in (true); + + abstract void f2() /* */ + in (true); + + abstract bool f3() // + out (r; r); + + abstract bool f4() /* */ + out (r; r); + + abstract void f5() // + do { + } + + abstract void f6() /* */ + do { + } + + abstract bool f7() // + in (true) // + out (r; r) // + do // + { + return true; + } + + abstract bool f8() /* */ + in (true) /* */ + out (r; r) /* */ + do /* */ + { + return true; + } +} diff --git a/tests/knr/issue0528.d.ref b/tests/knr/issue0528.d.ref new file mode 100644 index 00000000..304b6965 --- /dev/null +++ b/tests/knr/issue0528.d.ref @@ -0,0 +1,3 @@ +void f() return +do { +} diff --git a/tests/knr/keep_break_in_array_chain.d.ref b/tests/knr/keep_break_in_array_chain.d.ref new file mode 100644 index 00000000..b8cf5777 --- /dev/null +++ b/tests/knr/keep_break_in_array_chain.d.ref @@ -0,0 +1,6 @@ +unittest { + functionLengthDoesMatter([ + firstFunctionInChain("A").seconFunctionInChain("B").value, + firstFunctionInChain("A").seconFunctionInChain("B").value + ]); +} diff --git a/tests/knr/keep_single_indent.d.ref b/tests/knr/keep_single_indent.d.ref new file mode 100644 index 00000000..5faf64ab --- /dev/null +++ b/tests/knr/keep_single_indent.d.ref @@ -0,0 +1,44 @@ +unittest { + { + bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo, + Three charlie, double delta) + { + if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo + && foxtrot && golf && hotel && india && juliet) { + } + } + } +} + +void f() +{ + string a = "foo" + ~ "bar" /* bar */ + ~ "baz"; +} + +unittest { + if (a) { + while (sBraceDepth == 0 && indents.topIsTemp() + && ((indents.top != tok!"if" && indents.top != tok!"version") + || !peekIs(tok!"else"))) + a(); + } +} + +unittest { + callFunc({ int i = 10; return i; }); + callFunc({ + int i = 10; + foo(alpha, bravo, charlie, delta, echo, foxtrot, golf, echo); + doStuff(withThings, andOtherStuff); + return i; + }); + callFunc({ + int i = 10; + foo(alpha_longVarName, bravo_longVarName, charlie_longVarName, delta_longVarName, + echo_longVarName, foxtrot_longVarName, golf_longVarName, echo_longVarName); + doStuff(withThings, andOtherStuff); + return i; + }, more_stuff); +} diff --git a/tests/knr/single_indent.d.ref b/tests/knr/single_indent.d.ref new file mode 100644 index 00000000..47e34b5e --- /dev/null +++ b/tests/knr/single_indent.d.ref @@ -0,0 +1,36 @@ +unittest { + { + bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo, + Three charlie, double delta) + { + if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo + && foxtrot && golf && hotel && india && juliet) { + } + } + } +} + +unittest { + if (a) { + while (sBraceDepth == 0 && indents.topIsTemp() + && ((indents.top != tok!"if" && indents.top != tok!"version") || !peekIs(tok!"else"))) + a(); + } +} + +unittest { + callFunc({ int i = 10; return i; }); + callFunc({ + int i = 10; + foo(alpha, bravo, charlie, delta, echo, foxtrot, golf, echo); + doStuff(withThings, andOtherStuff); + return i; + }); + callFunc({ + int i = 10; + foo(alpha_longVarName, bravo_longVarName, charlie_longVarName, delta_longVarName, + echo_longVarName, foxtrot_longVarName, golf_longVarName, echo_longVarName); + doStuff(withThings, andOtherStuff); + return i; + }, more_stuff); +}