Fix unittests (#153)

* Fix broken unittests in vcall_in_ctor.d

* Fix broken unittest in line_length.d

* Fix broken unittest in redundant_attributes.d

* Fix broken unittest in if_constraints_indent.d

* Fix broken unittests in auto_function.d

* Fix broken unittest in always_curly.d
This commit is contained in:
Razvan Nitu 2024-10-08 12:01:42 +03:00 committed by Vladiwostok
parent 517b017058
commit 444f4e20b6
6 changed files with 8 additions and 27 deletions

View file

@ -264,11 +264,11 @@ unittest
assertAutoFix(q{
void test() {
do return; while(true) // fix:0
do return; while(true); // fix:0
}
}c, q{
void test() {
do { return; } while(true) // fix:0
do { return; } while(true); // fix:0
}
}c, sac, true);

View file

@ -195,18 +195,15 @@ unittest
assertAnalyzerWarningsDMD(q{
auto doStuff(){} // [warn]: %s
extern(C) auto doStuff();
}c.format(MESSAGE), sac);
assertAnalyzerWarningsDMD(q{
auto doStuff(){} // [warn]: %s
@disable auto doStuff();
}c.format(MESSAGE), sac);
assertAnalyzerWarningsDMD(q{
@property doStuff(){} // [warn]: %s
@safe doStuff(){} // [warn]: %s
@disable doStuff();
@safe void doStuff();
}c.format(MESSAGE_INSERT, MESSAGE_INSERT), sac);

View file

@ -266,7 +266,7 @@ unittest
StaticAnalysisConfig sac = disabledConfig();
sac.if_constraints_indent = Check.enabled;
assertAnalyzerWarnings(`void foo() {
''
assertAnalyzerWarnings(`void foo() {
f;
}`, sac);
}

View file

@ -156,8 +156,8 @@ assert("foo" == "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
}c, sac);
assertAnalyzerWarningsDMD(q{
assert("foo" == "boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo5");
assert("foo" == "booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo6"); // [warn]: Line is longer than 120 characters
static assert("foo" == "booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo5");
static assert("foo" == "boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo6"); // [warn]: Line is longer than 120 characters
}c, sac);
// reduced from std/regex/internal/thompson.d

View file

@ -111,7 +111,7 @@ private:
private int foo2; // [warn]: Same visibility attribute used as defined on line 4.
private void foo() // [warn]: Same visibility attribute used as defined on line 4.
{
private int blah;
int blah;
}
}}c, sac);

View file

@ -226,7 +226,7 @@ unittest
bar(); // [warn]: %s
}
private: public void bar();
public private {void foo(){}}
private {void foo(){}}
}
}c.format(MSG), sac);
@ -247,22 +247,6 @@ unittest
}
}, sac);
assertAnalyzerWarningsDMD(q{
class Bar
{
this(){foo();}
private public protected private void foo(){}
}
}, sac);
assertAnalyzerWarningsDMD(q{
class Bar
{
this(){foo();}
final private public protected void foo(){}
}
}, sac);
assertAnalyzerWarningsDMD(q{
class Bar
{