Improve line wrapping heuristics
This commit is contained in:
parent
0eea53a628
commit
e6fe5df515
|
@ -1220,8 +1220,10 @@ private:
|
|||
void regenLineBreakHints(immutable size_t i)
|
||||
{
|
||||
immutable size_t j = expressionEndIndex(i);
|
||||
// Use magical negative value for array literals and wrap indents
|
||||
immutable inLvl = (indents.topIsWrap() || indents.topIs(tok!"]")) ? -indentLevel : indentLevel;
|
||||
linebreakHints = chooseLineBreakTokens(i, tokens[i .. j], depths[i .. j],
|
||||
config, currentLineLength, indentLevel);
|
||||
config, currentLineLength, inLvl);
|
||||
}
|
||||
|
||||
void regenLineBreakHintsIfNecessary(immutable size_t i)
|
||||
|
|
|
@ -209,6 +209,8 @@ private:
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if (parenCount == 0 && arr[i] == tok!"(")
|
||||
size++;
|
||||
if (arr[i] == tok!"!")
|
||||
size++;
|
||||
parenCount = pc;
|
||||
|
|
|
@ -136,7 +136,7 @@ int breakCost(IdType p, IdType c) pure nothrow @safe @nogc
|
|||
case tok!"(":
|
||||
return 60;
|
||||
case tok!"[":
|
||||
return 400;
|
||||
return 300;
|
||||
case tok!":":
|
||||
case tok!";":
|
||||
case tok!"^^":
|
||||
|
@ -182,7 +182,7 @@ int breakCost(IdType p, IdType c) pure nothrow @safe @nogc
|
|||
case tok!"+=":
|
||||
return 200;
|
||||
case tok!".":
|
||||
return p == tok!")" ? 0 : 900;
|
||||
return p == tok!")" ? 0 : 300;
|
||||
default:
|
||||
return 1000;
|
||||
}
|
||||
|
|
|
@ -18,14 +18,12 @@ struct State
|
|||
import core.bitop : popcnt, bsf;
|
||||
import std.algorithm : min, map, sum;
|
||||
|
||||
immutable int remainingCharsMultiplier = config.max_line_length
|
||||
- config.dfmt_soft_max_line_length;
|
||||
immutable int newlinePenalty = remainingCharsMultiplier * 20;
|
||||
immutable int remainingCharsMultiplier = 25;
|
||||
immutable int newlinePenalty = 480;
|
||||
|
||||
this.breaks = breaks;
|
||||
this._cost = 0;
|
||||
this._solved = true;
|
||||
int ll = currentLineLength;
|
||||
|
||||
if (breaks == 0)
|
||||
{
|
||||
|
@ -36,8 +34,6 @@ struct State
|
|||
this._cost += longPenalty;
|
||||
this._solved = longPenalty < newlinePenalty;
|
||||
}
|
||||
else
|
||||
this._solved = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -49,15 +45,16 @@ struct State
|
|||
immutable currentType = tokens[i].type;
|
||||
immutable p = abs(depths[i]);
|
||||
immutable bc = breakCost(prevType, currentType) * (p == 0 ? 1 : p * 2);
|
||||
this._cost += bc;
|
||||
this._cost += bc + newlinePenalty;
|
||||
}
|
||||
|
||||
int ll = currentLineLength;
|
||||
size_t i = 0;
|
||||
foreach (_; 0 .. uint.sizeof * 8)
|
||||
{
|
||||
immutable uint k = breaks >>> i;
|
||||
immutable bool b = k == 0;
|
||||
immutable uint bits = b ? 0 : bsf(k);
|
||||
immutable uint bits = b ? ALGORITHMIC_COMPLEXITY_SUCKS : bsf(k);
|
||||
immutable size_t j = min(i + bits + 1, tokens.length);
|
||||
ll += tokens[i .. j].map!(a => tokenLength(a)).sum();
|
||||
if (ll > config.dfmt_soft_max_line_length)
|
||||
|
@ -71,12 +68,14 @@ struct State
|
|||
break;
|
||||
}
|
||||
i = j;
|
||||
ll = indentLevel * config.indent_size;
|
||||
if (indentLevel < 0)
|
||||
ll = (abs(indentLevel) + 1) * config.indent_size;
|
||||
else
|
||||
ll = (indentLevel + (i == 0 ? 0 : 1)) * config.indent_size;
|
||||
if (b)
|
||||
break;
|
||||
}
|
||||
}
|
||||
this._cost += popcnt(breaks) * newlinePenalty;
|
||||
}
|
||||
|
||||
int cost() const pure nothrow @safe @property
|
||||
|
@ -93,13 +92,12 @@ struct State
|
|||
{
|
||||
import core.bitop : bsf, popcnt;
|
||||
|
||||
if (_cost < other._cost || (_cost == other._cost && ((breaks != 0
|
||||
&& other.breaks != 0 && bsf(breaks) > bsf(other.breaks))
|
||||
|| (_solved && !other.solved))))
|
||||
{
|
||||
if (_cost < other._cost)
|
||||
return -1;
|
||||
}
|
||||
return other._cost > _cost;
|
||||
if (_cost == other._cost && (breaks != 0 && other.breaks != 0
|
||||
&& bsf(breaks) > bsf(other.breaks)))
|
||||
return -1;
|
||||
return _cost > other._cost;
|
||||
}
|
||||
|
||||
bool opEquals(ref const State other) const pure nothrow @safe
|
||||
|
@ -119,6 +117,12 @@ private:
|
|||
bool _solved;
|
||||
}
|
||||
|
||||
private enum ALGORITHMIC_COMPLEXITY_SUCKS = uint.sizeof * 8;
|
||||
|
||||
/**
|
||||
* Note: Negative values for `indentLevel` are treated specially: costs for
|
||||
* continuation indents are reduced. This is used for array literals.
|
||||
*/
|
||||
size_t[] chooseLineBreakTokens(size_t index, const Token[] tokens,
|
||||
immutable short[] depths, const Config* config, int currentLineLength, int indentLevel)
|
||||
{
|
||||
|
@ -136,24 +140,24 @@ size_t[] chooseLineBreakTokens(size_t index, const Token[] tokens,
|
|||
return retVal;
|
||||
}
|
||||
|
||||
enum ALGORITHMIC_COMPLEXITY_SUCKS = uint.sizeof * 8;
|
||||
immutable size_t tokensEnd = min(tokens.length, ALGORITHMIC_COMPLEXITY_SUCKS);
|
||||
auto open = new RedBlackTree!State;
|
||||
open.insert(State(0, tokens[0 .. tokensEnd], depths[0 .. tokensEnd], config,
|
||||
currentLineLength, indentLevel));
|
||||
State lowest;
|
||||
while (!open.empty)
|
||||
lowest._solved = false;
|
||||
int tries = 0;
|
||||
while (!open.empty && tries < 10_00)
|
||||
{
|
||||
tries++;
|
||||
State current = open.front();
|
||||
if (current.cost < lowest.cost)
|
||||
lowest = current;
|
||||
open.removeFront();
|
||||
if (current.solved)
|
||||
{
|
||||
return genRetVal(current.breaks, index);
|
||||
}
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd],
|
||||
depths[0 .. tokensEnd], current.breaks, config, currentLineLength, indentLevel);
|
||||
if (current < lowest)
|
||||
lowest = current;
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
if (open.empty)
|
||||
return genRetVal(lowest.breaks, index);
|
||||
|
@ -166,7 +170,7 @@ void validMoves(OR)(auto ref OR output, const Token[] tokens,
|
|||
immutable short[] depths, uint current, const Config* config,
|
||||
int currentLineLength, int indentLevel)
|
||||
{
|
||||
import std.algorithm : sort, canFind;
|
||||
import std.algorithm : sort, canFind, min;
|
||||
import std.array : insertInPlace;
|
||||
|
||||
foreach (i, token; tokens)
|
||||
|
|
|
@ -7,8 +7,8 @@ unittest
|
|||
{
|
||||
|
||||
}
|
||||
abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234)
|
||||
.abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234);
|
||||
abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234)
|
||||
.abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,28 +9,25 @@ string generateFixedLengthCases()
|
|||
|
||||
string[] fixedLengthTokens = [
|
||||
"abstract", "alias", "align", "asm", "assert", "auto", "body", "bool",
|
||||
"break", "byte", "case", "cast", "catch", "cdouble", "cent", "cfloat",
|
||||
"char", "class", "const", "continue", "creal", "dchar", "debug",
|
||||
"default", "delegate", "delete", "deprecated", "do", "double", "else",
|
||||
"enum", "export", "extern", "false", "final", "finally", "float",
|
||||
"for", "foreach", "foreach_reverse", "function", "goto", "idouble",
|
||||
"if", "ifloat", "immutable", "import", "in", "inout", "int",
|
||||
"interface", "invariant", "ireal", "is", "lazy", "long", "macro",
|
||||
"mixin", "module", "new", "nothrow", "null", "out", "override",
|
||||
"package", "pragma", "private", "protected", "public", "pure", "real",
|
||||
"ref", "return", "scope", "shared", "short", "static", "struct",
|
||||
"super", "switch", "synchronized", "template", "this", "throw", "true",
|
||||
"try", "typedef", "typeid", "typeof", "ubyte", "ucent", "uint",
|
||||
"ulong", "union", "unittest", "ushort", "version", "void", "volatile",
|
||||
"wchar", "while", "with", "__DATE__", "__EOF__", "__FILE__",
|
||||
"break", "byte", "case", "cast", "catch", "cdouble", "cent", "cfloat", "char", "class",
|
||||
"const", "continue", "creal", "dchar", "debug", "default", "delegate", "delete", "deprecated",
|
||||
"do", "double", "else", "enum", "export", "extern", "false", "final", "finally", "float",
|
||||
"for", "foreach", "foreach_reverse", "function", "goto", "idouble", "if", "ifloat", "immutable",
|
||||
"import", "in", "inout", "int", "interface", "invariant", "ireal", "is",
|
||||
"lazy", "long", "macro", "mixin", "module", "new", "nothrow", "null", "out", "override",
|
||||
"package", "pragma", "private", "protected", "public", "pure", "real", "ref", "return", "scope",
|
||||
"shared", "short", "static", "struct", "super", "switch", "synchronized", "template", "this",
|
||||
"throw", "true", "try", "typedef", "typeid", "typeof", "ubyte", "ucent", "uint", "ulong",
|
||||
"union", "unittest", "ushort", "version", "void", "volatile", "wchar",
|
||||
"while", "with", "__DATE__", "__EOF__", "__FILE__",
|
||||
"__FUNCTION__", "__gshared", "__LINE__", "__MODULE__", "__parameters",
|
||||
"__PRETTY_FUNCTION__", "__TIME__", "__TIMESTAMP__", "__traits",
|
||||
"__vector", "__VENDOR__", "__VERSION__", ",", ".", "..", "...", "/",
|
||||
"/=", "!", "!<", "!<=", "!<>", "!<>=", "!=", "!>", "!>=", "$", "%",
|
||||
"%=", "&", "&&", "&=", "(", ")", "*", "*=", "+", "++", "+=", "-",
|
||||
"--", "-=", ":", ";", "<", "<<", "<<=", "<=", "<>", "<>=", "=", "==",
|
||||
"=>", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "]", "^",
|
||||
"^=", "^^", "^^=", "{", "|", "|=", "||", "}", "~", "~="
|
||||
"__PRETTY_FUNCTION__", "__TIME__", "__TIMESTAMP__",
|
||||
"__traits", "__vector", "__VENDOR__", "__VERSION__", ",", ".", "..",
|
||||
"...", "/", "/=", "!", "!<", "!<=", "!<>", "!<>=", "!=", "!>", "!>=",
|
||||
"$", "%", "%=", "&", "&&", "&=", "(", ")", "*", "*=", "+", "++",
|
||||
"+=", "-", "--", "-=", ":", ";", "<", "<<", "<<=", "<=", "<>", "<>=",
|
||||
"=", "==", "=>", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[",
|
||||
"]", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "}", "~", "~="
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
struct Test
|
||||
{
|
||||
this(string name, string[] aliasList, string briefDescription, string examDesc,
|
||||
string onOpenDesc, string openDesc, string onCloseDesc,
|
||||
string closeDesc, Flag!"canOpen" canOpen, Flag!"canClose" canClose,
|
||||
Flag!"isOpen" isOpen)
|
||||
this(string name, string[] aliasList, string briefDescription, string examDesc, string onOpenDesc,
|
||||
string openDesc, string onCloseDesc, string closeDesc,
|
||||
Flag!"canOpen" canOpen, Flag!"canClose" canClose, Flag!"isOpen" isOpen)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
unittest
|
||||
{
|
||||
testScene = new Scene("TestScene : Test", sceneDescriptions["TestScene"],
|
||||
connectDescriptions["TestScene"], delegate(Scene scene) {
|
||||
import std.stdio;
|
||||
|
||||
if (!scene.alreadyEntered)
|
||||
{
|
||||
fwriteln(
|
||||
"This is a test. This is a test. This is a test. This is a test. This is a test. Test12.");
|
||||
auto p = cast(Portal) sceneManager.previousScene;
|
||||
scene.destroyCurrentScript();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -17,9 +17,8 @@ unittest
|
|||
});
|
||||
callFunc({
|
||||
int i = 10;
|
||||
foo(alpha_longVarName, bravo_longVarName, charlie_longVarName,
|
||||
delta_longVarName, echo_longVarName, foxtrot_longVarName,
|
||||
golf_longVarName, echo_longVarName);
|
||||
foo(alpha_longVarName, bravo_longVarName, charlie_longVarName, delta_longVarName,
|
||||
echo_longVarName, foxtrot_longVarName, golf_longVarName, echo_longVarName);
|
||||
doStuff(withThings, andOtherStuff);
|
||||
return i;
|
||||
}, more_stuff);
|
||||
|
|
|
@ -2,7 +2,7 @@ unittest
|
|||
{
|
||||
{
|
||||
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
in
|
||||
{
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ unittest
|
|||
}
|
||||
|
||||
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
in
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
unittest
|
||||
{
|
||||
if (info > 0)
|
||||
throw new ExceptionWithLongName(
|
||||
std.string.format(
|
||||
throw new ExceptionWithLongName(std.string.format(
|
||||
"During the LU factorization, it was found that the " ~ "%sth diagonal value is exactly zero.",
|
||||
info), file, line);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
|
||||
/+
|
||||
// good
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
// bad
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd],
|
||||
depths[0 .. tokensEnd], current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
+/
|
|
@ -2,8 +2,7 @@ void main(string[] args)
|
|||
{
|
||||
if (prevLocation != size_t.max)
|
||||
{
|
||||
addErrorMessage(line, column, KEY,
|
||||
"Expression %s is true: already checked on line %d.".format(
|
||||
expressions[prevLocation].formatted, expressions[prevLocation].line));
|
||||
addErrorMessage(line, column, KEY, "Expression %s is true: already checked on line %d.".format(
|
||||
expressions[prevLocation].formatted, expressions[prevLocation].line));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
unittest
|
||||
{
|
||||
testScene = new Scene
|
||||
(
|
||||
"TestScene : Test",
|
||||
sceneDescriptions["TestScene"],
|
||||
connectDescriptions["TestScene"],
|
||||
delegate(Scene scene)
|
||||
{
|
||||
import std.stdio;
|
||||
|
||||
if (!scene.alreadyEntered)
|
||||
{
|
||||
fwriteln("This is a test. This is a test. This is a test. This is a test. This is a test. Test12.");
|
||||
auto p = cast(Portal)sceneManager.previousScene;
|
||||
scene.destroyCurrentScript();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
|
||||
/+
|
||||
// good
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
// bad
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd],
|
||||
depths[0 .. tokensEnd], current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
+/
|
|
@ -5,8 +5,8 @@ unittest {
|
|||
.filter!(bravo => charlie[10] > 90000).sum()) {
|
||||
|
||||
}
|
||||
abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234)
|
||||
.abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234);
|
||||
abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234)
|
||||
.abcdeabcdeabcde(12341234).abcdeabcdeabcde(12341234);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,28 +8,25 @@ string generateFixedLengthCases() {
|
|||
|
||||
string[] fixedLengthTokens = [
|
||||
"abstract", "alias", "align", "asm", "assert", "auto", "body", "bool",
|
||||
"break", "byte", "case", "cast", "catch", "cdouble", "cent", "cfloat",
|
||||
"char", "class", "const", "continue", "creal", "dchar", "debug",
|
||||
"default", "delegate", "delete", "deprecated", "do", "double", "else",
|
||||
"enum", "export", "extern", "false", "final", "finally", "float",
|
||||
"for", "foreach", "foreach_reverse", "function", "goto", "idouble",
|
||||
"if", "ifloat", "immutable", "import", "in", "inout", "int",
|
||||
"interface", "invariant", "ireal", "is", "lazy", "long", "macro",
|
||||
"mixin", "module", "new", "nothrow", "null", "out", "override",
|
||||
"package", "pragma", "private", "protected", "public", "pure", "real",
|
||||
"ref", "return", "scope", "shared", "short", "static", "struct",
|
||||
"super", "switch", "synchronized", "template", "this", "throw", "true",
|
||||
"try", "typedef", "typeid", "typeof", "ubyte", "ucent", "uint",
|
||||
"ulong", "union", "unittest", "ushort", "version", "void", "volatile",
|
||||
"wchar", "while", "with", "__DATE__", "__EOF__", "__FILE__",
|
||||
"break", "byte", "case", "cast", "catch", "cdouble", "cent", "cfloat", "char", "class",
|
||||
"const", "continue", "creal", "dchar", "debug", "default", "delegate", "delete", "deprecated",
|
||||
"do", "double", "else", "enum", "export", "extern", "false", "final", "finally", "float",
|
||||
"for", "foreach", "foreach_reverse", "function", "goto", "idouble", "if", "ifloat", "immutable",
|
||||
"import", "in", "inout", "int", "interface", "invariant", "ireal", "is",
|
||||
"lazy", "long", "macro", "mixin", "module", "new", "nothrow", "null", "out", "override",
|
||||
"package", "pragma", "private", "protected", "public", "pure", "real", "ref", "return", "scope",
|
||||
"shared", "short", "static", "struct", "super", "switch", "synchronized", "template", "this",
|
||||
"throw", "true", "try", "typedef", "typeid", "typeof", "ubyte", "ucent", "uint", "ulong",
|
||||
"union", "unittest", "ushort", "version", "void", "volatile", "wchar",
|
||||
"while", "with", "__DATE__", "__EOF__", "__FILE__",
|
||||
"__FUNCTION__", "__gshared", "__LINE__", "__MODULE__", "__parameters",
|
||||
"__PRETTY_FUNCTION__", "__TIME__", "__TIMESTAMP__", "__traits",
|
||||
"__vector", "__VENDOR__", "__VERSION__", ",", ".", "..", "...", "/",
|
||||
"/=", "!", "!<", "!<=", "!<>", "!<>=", "!=", "!>", "!>=", "$", "%",
|
||||
"%=", "&", "&&", "&=", "(", ")", "*", "*=", "+", "++", "+=", "-",
|
||||
"--", "-=", ":", ";", "<", "<<", "<<=", "<=", "<>", "<>=", "=", "==",
|
||||
"=>", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "]", "^",
|
||||
"^=", "^^", "^^=", "{", "|", "|=", "||", "}", "~", "~="
|
||||
"__PRETTY_FUNCTION__", "__TIME__", "__TIMESTAMP__",
|
||||
"__traits", "__vector", "__VENDOR__", "__VERSION__", ",", ".", "..",
|
||||
"...", "/", "/=", "!", "!<", "!<=", "!<>", "!<>=", "!=", "!>", "!>=",
|
||||
"$", "%", "%=", "&", "&&", "&=", "(", ")", "*", "*=", "+", "++",
|
||||
"+=", "-", "--", "-=", ":", ";", "<", "<<", "<<=", "<=", "<>", "<>=",
|
||||
"=", "==", "=>", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[",
|
||||
"]", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "}", "~", "~="
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
struct Test {
|
||||
this(string name, string[] aliasList, string briefDescription, string examDesc,
|
||||
string onOpenDesc, string openDesc, string onCloseDesc,
|
||||
string closeDesc, Flag!"canOpen" canOpen, Flag!"canClose" canClose,
|
||||
Flag!"isOpen" isOpen) {
|
||||
this(string name, string[] aliasList, string briefDescription, string examDesc, string onOpenDesc,
|
||||
string openDesc, string onCloseDesc, string closeDesc,
|
||||
Flag!"canOpen" canOpen, Flag!"canClose" canClose, Flag!"isOpen" isOpen) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
unittest {
|
||||
testScene = new Scene("TestScene : Test", sceneDescriptions["TestScene"],
|
||||
connectDescriptions["TestScene"], delegate(Scene scene) {
|
||||
import std.stdio;
|
||||
|
||||
if (!scene.alreadyEntered) {
|
||||
fwriteln(
|
||||
"This is a test. This is a test. This is a test. This is a test. This is a test. Test12.");
|
||||
auto p = cast(Portal) sceneManager.previousScene;
|
||||
scene.destroyCurrentScript();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -16,9 +16,8 @@ unittest {
|
|||
});
|
||||
callFunc({
|
||||
int i = 10;
|
||||
foo(alpha_longVarName, bravo_longVarName, charlie_longVarName,
|
||||
delta_longVarName, echo_longVarName, foxtrot_longVarName,
|
||||
golf_longVarName, echo_longVarName);
|
||||
foo(alpha_longVarName, bravo_longVarName, charlie_longVarName, delta_longVarName,
|
||||
echo_longVarName, foxtrot_longVarName, golf_longVarName, echo_longVarName);
|
||||
doStuff(withThings, andOtherStuff);
|
||||
return i;
|
||||
}, more_stuff);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
unittest {
|
||||
{
|
||||
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
in {
|
||||
}
|
||||
body {
|
||||
|
@ -11,7 +11,7 @@ unittest {
|
|||
}
|
||||
|
||||
public Vector!(T) opBinary(string op, string file = __FILE__, size_t line = __LINE__)(
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
const Vector!(T) x) const if (op == "*")
|
||||
in {
|
||||
}
|
||||
body {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
unittest {
|
||||
if (info > 0)
|
||||
throw new ExceptionWithLongName(
|
||||
std.string.format(
|
||||
throw new ExceptionWithLongName(std.string.format(
|
||||
"During the LU factorization, it was found that the " ~ "%sth diagonal value is exactly zero.",
|
||||
info), file, line);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
unittest {
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
|
||||
/+
|
||||
// good
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd], depths[0 .. tokensEnd],
|
||||
current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
// bad
|
||||
unittest
|
||||
{
|
||||
validMoves!(typeof(open))(open, tokens[0 .. tokensEnd],
|
||||
depths[0 .. tokensEnd], current.breaks, config, currentLineLength, indentLevel);
|
||||
}
|
||||
+/
|
|
@ -1,7 +1,6 @@
|
|||
void main(string[] args) {
|
||||
if (prevLocation != size_t.max) {
|
||||
addErrorMessage(line, column, KEY,
|
||||
"Expression %s is true: already checked on line %d.".format(
|
||||
expressions[prevLocation].formatted, expressions[prevLocation].line));
|
||||
addErrorMessage(line, column, KEY, "Expression %s is true: already checked on line %d.".format(
|
||||
expressions[prevLocation].formatted, expressions[prevLocation].line));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue