Skip to content

Commit

Permalink
Fix unittests (#153)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
RazvanN7 authored Oct 8, 2024
1 parent 0ce3107 commit 1363070
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/dscanner/analysis/always_curly.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 0 additions & 3 deletions src/dscanner/analysis/auto_function.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/dscanner/analysis/if_constraints_indent.d
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ unittest
StaticAnalysisConfig sac = disabledConfig();
sac.if_constraints_indent = Check.enabled;

assertAnalyzerWarnings(`void foo() {
''
assertAnalyzerWarnings(`void foo() {
f;
}`, sac);
}
4 changes: 2 additions & 2 deletions src/dscanner/analysis/line_length.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dscanner/analysis/redundant_attributes.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
18 changes: 1 addition & 17 deletions src/dscanner/analysis/vcall_in_ctor.d
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ unittest
bar(); // [warn]: %s
}
private: public void bar();
public private {void foo(){}}
private {void foo(){}}
}
}c.format(MSG), sac);

Expand All @@ -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
{
Expand Down

0 comments on commit 1363070

Please sign in to comment.