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{ assertAutoFix(q{
void test() { void test() {
do return; while(true) // fix:0 do return; while(true); // fix:0
} }
}c, q{ }c, q{
void test() { void test() {
do { return; } while(true) // fix:0 do { return; } while(true); // fix:0
} }
}c, sac, true); }c, sac, true);

View file

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

View file

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

View file

@ -156,8 +156,8 @@ assert("foo" == "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
}c, sac); }c, sac);
assertAnalyzerWarningsDMD(q{ assertAnalyzerWarningsDMD(q{
assert("foo" == "boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo5"); static assert("foo" == "booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo5");
assert("foo" == "booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo6"); // [warn]: Line is longer than 120 characters static assert("foo" == "boooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo6"); // [warn]: Line is longer than 120 characters
}c, sac); }c, sac);
// reduced from std/regex/internal/thompson.d // 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 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 void foo() // [warn]: Same visibility attribute used as defined on line 4.
{ {
private int blah; int blah;
} }
}}c, sac); }}c, sac);

View file

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