Fix tests

This commit is contained in:
Clément Fournier
2020-04-27 19:13:00 +02:00
parent c3670e3b59
commit 8f363ceb3d
4 changed files with 10 additions and 4 deletions

View File

@ -294,6 +294,9 @@ public final class PropertyFactory {
*
* @return A new builder
*/
// Note: there is a bug, whereby the default value can be set on
// the builder, even if it wasn't registered in the constants
// This is fixed in the framework refactoring
public static <T> GenericPropertyBuilder<T> enumProperty(String name, Map<String, T> nameToValue) {
// TODO find solution to document the set of possible values
// At best, map that requirement to a constraint (eg make parser return null if not found, and

View File

@ -52,8 +52,8 @@ public class CodeClimateRendererTest extends AbstractRendererTest {
+ "Name | Value | Description\\n" + "--- | --- | ---\\n"
+ "violationSuppressRegex | | Suppress violations with messages matching a regular expression\\n"
+ "violationSuppressXPath | | Suppress violations on nodes which match a given relative XPath expression.\\n"
+ "multiString | default1,default2 | multi string property\\n"
+ "stringProperty | the string value\\nsecond line with 'quotes' | simple string property\\n"
+ "multiString | default1,default2 | multi string property\\n"
+ "\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"" + getSourceCodeFilename() + "\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}"
+ "\u0000" + PMD.EOL;
}

View File

@ -70,7 +70,7 @@ public class EcmascriptParserOptions extends ParserOptions {
public static final PropertyDescriptor<Version> RHINO_LANGUAGE_VERSION =
PropertyFactory.enumProperty("rhinoLanguageVersion", associateBy(asList(Version.values()), Version::getLabel))
.desc("Specifies the Rhino Language Version to use for parsing. Defaults to Rhino default.")
.defaultValue(Version.VERSION_DEFAULT)
.defaultValue(Version.VERSION_ES6)
.build();
private boolean recordingComments;

View File

@ -5,11 +5,14 @@
package net.sourceforge.pmd.lang.ecmascript;
import static net.sourceforge.pmd.lang.ParserOptionsTest.verifyOptionsEqualsHashcode;
import static net.sourceforge.pmd.util.CollectionUtil.listOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import org.junit.Test;
import net.sourceforge.pmd.lang.ParserOptions;
@ -68,8 +71,8 @@ public class EcmascriptParserOptionsTest {
@Test
public void testEqualsHashcode() throws Exception {
@SuppressWarnings("unchecked")
PropertyDescriptor<Boolean>[] properties = new PropertyDescriptor[] {EcmascriptParserOptions.RECORDING_COMMENTS_DESCRIPTOR,
EcmascriptParserOptions.RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR,};
List<PropertyDescriptor<Boolean>> properties = listOf(EcmascriptParserOptions.RECORDING_COMMENTS_DESCRIPTOR,
EcmascriptParserOptions.RECORDING_LOCAL_JSDOC_COMMENTS_DESCRIPTOR);
for (PropertyDescriptor<Boolean> property : properties) {
MyRule rule = new MyRule();