You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-07-17 13:07:50 +02:00
#398 Поправлен unit-тест.
Поправлен unit-тест для проверки UseGotoOperatorCheck.
This commit is contained in:
@ -68,27 +68,24 @@ public class UseGotoOperatorCheck
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
|
||||
if (object instanceof Block)
|
||||
Block block = (Block)object;
|
||||
for (Statement st : block.allStatements())
|
||||
{
|
||||
Block block = (Block)object;
|
||||
for (Statement st : block.allStatements())
|
||||
if (monitor.isCanceled())
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (st instanceof GotoStatement)
|
||||
{
|
||||
resultAcceptor.addIssue(Messages.UseGotoOperatorCheck_Use_Goto_operator, st);
|
||||
}
|
||||
|
||||
if (st instanceof LabeledStatement)
|
||||
{
|
||||
resultAcceptor.addIssue(Messages.UseGotoOperatorCheck_Use_Label_with_Goto_operator, st);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (st instanceof GotoStatement)
|
||||
{
|
||||
resultAcceptor.addIssue(Messages.UseGotoOperatorCheck_Use_Goto_operator, st);
|
||||
}
|
||||
|
||||
if (st instanceof LabeledStatement)
|
||||
{
|
||||
resultAcceptor.addIssue(Messages.UseGotoOperatorCheck_Use_Label_with_Goto_operator, st);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,13 +4,5 @@
|
||||
|
||||
~МеткаПервая:
|
||||
ТестоваяПеременная = 1;
|
||||
|
||||
ТестоваяПроцедура2()
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура ТестоваяПроцедура2()
|
||||
|
||||
//Какой-то код...
|
||||
|
||||
КонецПроцедуры
|
@ -1,8 +1,11 @@
|
||||
package com.e1c.v8codestyle.bsl.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@ -37,12 +40,16 @@ public class UseGotoOperatorCheckTest
|
||||
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(2, markers.size());
|
||||
|
||||
Marker marker = markers.get(0);
|
||||
assertEquals("3", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
|
||||
marker = markers.get(1);
|
||||
assertEquals("5", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
|
||||
Set<String> testMarkersList = Set.of("3", "5");
|
||||
Set<String> projectMarkersList = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (Marker marker : markers)
|
||||
{
|
||||
projectMarkersList.add(marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
|
||||
assertTrue(testMarkersList.equals(projectMarkersList));
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user