You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2026-05-21 02:19:05 +02:00
Merge pull request #1519 from alonthedark/feature/issue-1518-link-part-space
add LinkPartSpaceCheck qfix and test
This commit is contained in:
@@ -394,6 +394,9 @@
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.ServerExecutionSafeModeFix">
|
||||
</fix>
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.LinkPartSpaceFix">
|
||||
</fix>
|
||||
</extension>
|
||||
<extension
|
||||
point="com._1c.g5.v8.dt.bsl.ui.bslModuleTextInsertInfoService">
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2025, 1C-Soft LLC and others.
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* 1C-Soft LLC - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.e1c.v8codestyle.bsl.ui.qfix;
|
||||
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.InsertEdit;
|
||||
import org.eclipse.text.edits.ReplaceEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||
import com.e1c.g5.v8.dt.bsl.check.qfix.IXtextBslModuleFixModel;
|
||||
import com.e1c.g5.v8.dt.bsl.check.qfix.SingleVariantXtextBslModuleFix;
|
||||
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
|
||||
|
||||
/**
|
||||
* Correct format link part
|
||||
*
|
||||
* @author Ivan Sergeev
|
||||
*/
|
||||
@QuickFix(checkId = "link-part-comment-space", supplierId = "com.e1c.v8codestyle.bsl")
|
||||
public class LinkPartSpaceFix
|
||||
extends SingleVariantXtextBslModuleFix
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void configureFix(FixConfigurer configurer)
|
||||
{
|
||||
configurer.interactive(true)
|
||||
.description(Messages.LinkPartSpaceFix_Description)
|
||||
.details(Messages.LinkPartSpaceFix_Details);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException
|
||||
{
|
||||
int issueOffset = model.getIssue().getOffset();
|
||||
Module module = EcoreUtil2.getContainerOfType(model.getElement(), Module.class);
|
||||
INode moduleNode = NodeModelUtils.findActualNodeFor(module);
|
||||
if (moduleNode == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String editText = moduleNode.getText();
|
||||
int textLenght = editText.length();
|
||||
if (textLenght < issueOffset + 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
char checkChar = editText.charAt(issueOffset + 1);
|
||||
|
||||
if (!Character.isLetter(checkChar))
|
||||
{
|
||||
if (textLenght < issueOffset + 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
String nextChar = String.valueOf(editText.charAt(issueOffset + 2));
|
||||
if (nextChar.equals(" ") || nextChar.equals("\t")) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
{
|
||||
return new DeleteEdit(issueOffset + 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ReplaceEdit(issueOffset + 1, 1, " "); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new InsertEdit(issueOffset + 1, " "); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,9 @@ final class Messages
|
||||
public static String SelfAssignFix_Description;
|
||||
public static String SelfAssignFix_Details;
|
||||
|
||||
public static String LinkPartSpaceFix_Description;
|
||||
public static String LinkPartSpaceFix_Details;
|
||||
|
||||
static
|
||||
{
|
||||
// initialize resource bundle
|
||||
|
||||
+2
@@ -33,6 +33,8 @@ SelfAssignFix_Description = Remove self-assign variable
|
||||
SelfAssignFix_Details = Remove self-assign variable
|
||||
ServerExecutionSafeModeFix_description = Enable safe mode
|
||||
ServerExecutionSafeModeFix_details = Insert safe mode enable statement before "Execute" or "Eval" method call
|
||||
LinkPartSpaceFix_Description = Correct the link format 'See link'
|
||||
LinkPartSpaceFix_Details = Correct the link format 'See link'
|
||||
UndefinedMethodFix_func_title=Create function
|
||||
UndefinedMethodFix_func_desc=Create a new function in the module
|
||||
UndefinedMethodFix_proc_title=Create procedure
|
||||
|
||||
+4
@@ -41,6 +41,10 @@ ServerExecutionSafeModeFix_description = Включить безопасный
|
||||
|
||||
ServerExecutionSafeModeFix_details = Добавить включение безопасного режима перед вызовом метода "Выполнить" или "Вычислить"
|
||||
|
||||
LinkPartSpaceFix_Description = Привести ссылку к правильному формату 'См. Ссылка'
|
||||
|
||||
LinkPartSpaceFix_Details = Привести ссылку к правильному формату 'См. Ссылка'
|
||||
|
||||
MethodSemicolonExtraFix_Details = Удалить лишнюю точку с запятой
|
||||
|
||||
MethodSemicolonExtraFix_Description = Удалить лишнюю точку с запятой
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Space in link part comment
|
||||
|
||||
Missing space before link.
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
//IncorrectLink - SeeCatalogs.Catalog
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
//CorrectLink - See Catalogs.Catalog
|
||||
@@ -0,0 +1,11 @@
|
||||
# Пробел в описании метода перед ссылкой
|
||||
|
||||
Пропущенный пробел перед ссылкой в описании метода комментарием.
|
||||
|
||||
## Неправильно
|
||||
|
||||
//Неправильная ссылка - См.Справочники.Справочник1
|
||||
|
||||
## Правильно
|
||||
|
||||
//Правильная ссылка - См. Справочники.Справочник1
|
||||
@@ -196,6 +196,10 @@
|
||||
category="com.e1c.v8codestyle.bsl.comment"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.comment.check.RefLinkPartCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl.comment"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.comment.check.LinkPartSpaceCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl.comment"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.comment.check.TypeDefinitionCheck">
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2025, 1C-Soft LLC and others.
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* 1C-Soft LLC - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.e1c.v8codestyle.bsl.comment.check;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.scoping.IScopeProvider;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment;
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment.Description;
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.IBslCommentToken;
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.IDescriptionPart;
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.LinkPart;
|
||||
import com._1c.g5.v8.dt.bsl.model.Method;
|
||||
import com._1c.g5.v8.dt.core.platform.IBmModelManager;
|
||||
import com._1c.g5.v8.dt.core.platform.IResourceLookup;
|
||||
import com._1c.g5.v8.dt.core.platform.IV8Project;
|
||||
import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
|
||||
import com.e1c.g5.dt.core.api.naming.INamingService;
|
||||
import com.e1c.g5.dt.core.api.platform.BmOperationContext;
|
||||
import com.e1c.g5.v8.dt.check.CheckComplexity;
|
||||
import com.e1c.g5.v8.dt.check.ICheckParameters;
|
||||
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
|
||||
import com.e1c.g5.v8.dt.check.settings.IssueType;
|
||||
import com.e1c.v8codestyle.check.CommonSenseCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Validates {@link LinkPart} of documentation comment has a space before the link
|
||||
*
|
||||
* @author Ivan Sergeev
|
||||
*/
|
||||
public class LinkPartSpaceCheck
|
||||
extends AbstractDocCommentTypeCheck
|
||||
{
|
||||
private static final String CHECK_ID = "link-part-comment-space"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Instantiates a new reference link part check.
|
||||
*
|
||||
* @param resourceLookup service for look up workspace resources, see {@link IResourceLookup}, cannot be <code>null</code>
|
||||
* @param namingService service for getting names of EDT object and resources, cannot be <code>null</code>
|
||||
* @param bmModelManager service for getting instance of Bm Model by {@link EObject}, cannot be <code>null</code>
|
||||
* @param v8ProjectManager {@link IV8ProjectManager} for getting {@link IV8Project} by {@link EObject}, cannot be <code>null</code>
|
||||
* @param scopeProvider the scope provider service, cannot be {@code null}.
|
||||
*/
|
||||
@Inject
|
||||
public LinkPartSpaceCheck(IResourceLookup resourceLookup, INamingService namingService,
|
||||
IBmModelManager bmModelManager, IV8ProjectManager v8ProjectManager, IScopeProvider scopeProvider)
|
||||
{
|
||||
super(resourceLookup, namingService, bmModelManager, v8ProjectManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.LinkPartSpaceCheck_Title)
|
||||
.description(Messages.LinkPartSpaceCheck_Description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.CODE_STYLE)
|
||||
.extension(new CommonSenseCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||
.delegate(LinkPart.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkDocumentationCommentObject(IDescriptionPart object, BslDocumentationComment root,
|
||||
DocumentationCommentResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
BmOperationContext typeComputationContext, IProgressMonitor monitor)
|
||||
{
|
||||
LinkPart linkPart = (LinkPart)object;
|
||||
|
||||
if (object.getParent() instanceof Description)
|
||||
{
|
||||
String checkString = linkPart.getInitialContent();
|
||||
String stringLink = linkPart.getLinkText();
|
||||
Method method = root.getMethod();
|
||||
if (checkString.toLowerCase().indexOf(IBslCommentToken.LINK_RU.toLowerCase()) != -1
|
||||
|| checkString.toLowerCase().indexOf(IBslCommentToken.LINK.toLowerCase()) != -1)
|
||||
{
|
||||
INode node = NodeModelUtils.findActualNodeFor(method);
|
||||
if (node == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
String textMethod = node.getText();
|
||||
int indexCheckChar = textMethod.indexOf(checkString);
|
||||
int indexLinkText = checkString.indexOf(stringLink);
|
||||
if (indexLinkText == -1 || indexCheckChar == -1 || indexLinkText == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
char checkChar = checkString.charAt(indexLinkText - 1);
|
||||
char checkPrevChar = textMethod.charAt(indexCheckChar - 1);
|
||||
if (!String.valueOf(checkChar).equals(" ") //$NON-NLS-1$
|
||||
&& !Character.isLetter(checkPrevChar))
|
||||
{
|
||||
if (String.valueOf(checkChar).equals("\t")) //$NON-NLS-1$
|
||||
{
|
||||
return;
|
||||
}
|
||||
resultAceptor.addIssue(Messages.LinkPartSpaceCheck_Issue, linkPart.getLineNumber(),
|
||||
linkPart.getLinkTextOffset() - 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -73,6 +73,9 @@ final class Messages
|
||||
public static String RefLinkPartCheck_description;
|
||||
public static String RefLinkPartCheck_Link_referenced_to_unexisting_object;
|
||||
public static String RefLinkPartCheck_title;
|
||||
public static String LinkPartSpaceCheck_Description;
|
||||
public static String LinkPartSpaceCheck_Issue;
|
||||
public static String LinkPartSpaceCheck_Title;
|
||||
public static String TypeDefinitionCheck_description;
|
||||
public static String TypeDefinitionCheck_title;
|
||||
public static String TypeDefinitionCheck_Unkown_type_M_specified;
|
||||
|
||||
+6
@@ -114,6 +114,12 @@ RefLinkPartCheck_description = Documentation comment link referenced object exis
|
||||
|
||||
RefLinkPartCheck_title = Documentation comment link referenced object exist
|
||||
|
||||
LinkPartSpaceCheck_Description = Check for space after 'See' before link
|
||||
|
||||
LinkPartSpaceCheck_Title = Check for space after 'See' before link
|
||||
|
||||
LinkPartSpaceCheck_Issue = There must be a space after 'See' before the link
|
||||
|
||||
TypeDefinitionCheck_Unkown_type_M_specified = Unknown type "{0}" specified in documentation comment
|
||||
|
||||
TypeDefinitionCheck_description = Documentation comment type definition contains valid type name
|
||||
|
||||
+6
@@ -114,6 +114,12 @@ RefLinkPartCheck_description = Ссылка документирующего к
|
||||
|
||||
RefLinkPartCheck_title = Ссылка документирующего комментария на существующий объект
|
||||
|
||||
LinkPartSpaceCheck_Description = Проверка наличия пробельных символов после 'См.' перед ссылкой
|
||||
|
||||
LinkPartSpaceCheck_Title = Проверка наличия пробельных символов после 'См.' перед ссылкой
|
||||
|
||||
LinkPartSpaceCheck_Issue = Должен быть пробельный символ после 'См.' перед ссылкой
|
||||
|
||||
TypeDefinitionCheck_Unkown_type_M_specified = Неизвестный тип "{0}" указан в документирующем комментарии
|
||||
|
||||
TypeDefinitionCheck_description = Определение типа документирующего комментария содержит правильное имя типа
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См.: Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - See: Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См.:_Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - See:_Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См.:Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - See:Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См._Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - See_Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,9 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - См. Catalog.Catalog1
|
||||
//IncorrectLink - См.Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,9 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - See Catalog.Catalog1
|
||||
//IncorrectLink - SeeCatalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,9 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См.Catalog.Catalog1
|
||||
//CorrectLink - См. Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,9 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - SeeCatalog.Catalog1
|
||||
//CorrectLink - See Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - См.Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//IncorrectLink - SeeCatalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - См. Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - See Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - См. Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
@@ -0,0 +1,8 @@
|
||||
#Region Abcd
|
||||
|
||||
//CorrectLink - See Catalog.Catalog1
|
||||
Procedure Test()
|
||||
|
||||
EndProcedure
|
||||
|
||||
#EndRegion
|
||||
+319
@@ -0,0 +1,319 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2025, 1C-Soft LLC and others.
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* 1C-Soft LLC - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.e1c.v8codestyle.bsl.comment.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||
import com._1c.g5.v8.dt.validation.marker.StandardExtraInfo;
|
||||
import com.e1c.v8codestyle.bsl.check.itests.AbstractSingleModuleTestBase;
|
||||
import com.e1c.v8codestyle.bsl.comment.check.LinkPartSpaceCheck;
|
||||
|
||||
/**
|
||||
* Tests for {@link LinkPartSpaceCheck} check.
|
||||
*
|
||||
* @author Ivan Sergeev
|
||||
*/
|
||||
public class LinkPartSpaceCheckTest
|
||||
extends AbstractSingleModuleTestBase
|
||||
{
|
||||
public LinkPartSpaceCheckTest()
|
||||
{
|
||||
super(LinkPartSpaceCheck.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLink() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with underscore.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithUnderscore() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-underscore-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with underscore.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithUnderscoreRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-underscore-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon before.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColonBeforeUnderscore() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-before-underscore-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon before.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColonBeforeUnderscoreRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-before-underscore-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColon() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColonRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon before space.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColonBeforeSpace() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link with colon before space.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testIncorrectLinkWithColonBeforeSpaceRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "extra-colon-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link after another link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testLinkAfter() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part-after.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(4), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link after another link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testLinkAfterRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part-after-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(4), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link before another link
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testLinkBefore() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part-before.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test incorrect link before another link
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testLinkBeforeRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-missing-link-part-before-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(1, markers.size());
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals(Integer.valueOf(3), marker.getExtraInfo().get(StandardExtraInfo.TEXT_LINE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test correct link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testCorrectLink() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-non-missing-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertTrue(markers.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test correct link.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testCorrectLinkRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-non-missing-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertTrue(markers.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test correct link with tab.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testCorrectLinkWithTab() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-non-missing-tab-link-part.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertTrue(markers.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test correct link with tab.
|
||||
*
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Test
|
||||
public void testCorrectLinkWithTabRu() throws Exception
|
||||
{
|
||||
updateModule(FOLDER_RESOURCE + "space-non-missing-tab-link-part-ru.bsl");
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertTrue(markers.isEmpty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user