Update UnnecessaryBlockTest.java

This commit is contained in:
Sashko 2024-02-21 23:06:20 +02:00 committed by GitHub
parent e5247d1703
commit a015835756
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,11 +1,32 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.ecmascript.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryBlockTest extends PmdRuleTst {
// no additional unit tests
public class UnnecessaryBlockTest extends PmdRuleTst {
@Override
public void setUp() {
// Set up any required configurations or resources before running the tests
}
public void testUnnecessaryBlockInImportStatement() {
String code = "import { foo } from 'bar';\n" +
"{\n" +
" // Unnecessary block\n" +
"}\n";
// Assert that the PMD rule does not flag the unnecessary block within import statement
addSourceCodeTest(code, 0);
}
public void testUnnecessaryBlockInDestructuringAssignment() {
String code = "const { a, b } = obj;\n" +
"{\n" +
" // Unnecessary block\n" +
"}\n";
// Assert that the PMD rule does not flag the unnecessary block within destructuring assignment
addSourceCodeTest(code, 0);
}
}