Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke authored and Geod24 committed Oct 31, 2021
1 parent 2beb819 commit b776d5a
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 41 deletions.
6 changes: 3 additions & 3 deletions tests/knr/array_access.d.ref
Original file line number Diff line number Diff line change
@@ -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]
]);
}
36 changes: 18 additions & 18 deletions tests/knr/associative_array.d.ref
Original file line number Diff line number Diff line change
@@ -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
Expand Down
40 changes: 20 additions & 20 deletions tests/knr/associative_array_complex.d.ref
Original file line number Diff line number Diff line change
@@ -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))
]
])
])
]
]);
]
]);
}
37 changes: 37 additions & 0 deletions tests/knr/issue0451.d.ref
Original file line number Diff line number Diff line change
@@ -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;
}
}
3 changes: 3 additions & 0 deletions tests/knr/issue0528.d.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void f() return
do {
}
6 changes: 6 additions & 0 deletions tests/knr/keep_break_in_array_chain.d.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
unittest {
functionLengthDoesMatter([
firstFunctionInChain("A").seconFunctionInChain("B").value,
firstFunctionInChain("A").seconFunctionInChain("B").value
]);
}
44 changes: 44 additions & 0 deletions tests/knr/keep_single_indent.d.ref
Original file line number Diff line number Diff line change
@@ -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);
}
36 changes: 36 additions & 0 deletions tests/knr/single_indent.d.ref
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit b776d5a

Please sign in to comment.