-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ability to disable "no grammar" message
Fixes redhat-developer/vscode-xml#467 Signed-off-by: David Thompson <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/settings/SettingsMergeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.lemminx.settings; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
import org.eclipse.lemminx.extensions.contentmodel.settings.XMLValidationSettings; | ||
import org.eclipse.lsp4j.PublishDiagnosticsCapabilities; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SettingsMergeTest { | ||
|
||
@Test | ||
public void testValidationSettingsMerge() throws IllegalArgumentException, IllegalAccessException { | ||
XMLValidationSettings settings = new XMLValidationSettings(); | ||
settings.setEnabled(false); | ||
settings.setDisallowDocTypeDecl(true); | ||
settings.setNoGrammar("ignore"); | ||
settings.setResolveExternalEntities(true); | ||
settings.setCapabilities(new PublishDiagnosticsCapabilities()); | ||
settings.setNamespaces(null); | ||
settings.setSchema(null); | ||
XMLValidationSettings mergeTargetSettings = new XMLValidationSettings(); | ||
for (Field field : XMLValidationSettings.class.getDeclaredFields()) { | ||
field.setAccessible(true); | ||
assertNotEquals(field.get(mergeTargetSettings), field.get(settings), field.getName() + "was the same for both"); | ||
} | ||
mergeTargetSettings.merge(settings); | ||
assertEquals(settings, mergeTargetSettings); | ||
} | ||
|
||
} |