Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
270,600
FileEditorManagerEx () { return editorManager; }
getFileEditorManager
270,601
FileEditorWithProvider () { return mySelectedEditor == null ? null : new FileEditorWithProvider(mySelectedEditor, myProvider); }
getSelectedEditor
270,602
void (Runnable runnable, String name, Object groupId) { myHistory.onCommandStarted(); runnable.run(); myHistory.onSelectionChanged(); myHistory.onCommandFinished(getProject(), groupId); }
executeCommand
270,603
String () { return "EditorType"; }
getEditorTypeId
270,604
void () { myHistory.onCommandStarted(); myHistory.onCommandFinished(getProject(), null); assertFalse(myHistory.isBackAvailable()); assertFalse(myHistory.isForwardAvailable()); }
testNoHistoryRecording
270,605
void () { makeNavigationChange(myState2); assertTrue(myHistory.isBackAvailable()); assertFalse(myHistory.isForwardAvailable()); assertEquals(1, myHistory.getBackPlaces().size()); }
testNavigationRecording
270,606
void () { myEditorState = new MyState(true, "state1"); makeNavigationChange(new MyState(true, "state2")); assertTrue(myHistory.isBackAvailable()); assertFalse(myHistory.isForwardAvailable()); assertEquals(1, myHistory.getBackPlaces().size()); }
testMergingForwardPlaces
270,607
void () { pushTwoStates(); assertFalse(myHistory.isForwardAvailable()); assertTrue(myHistory.isBackAvailable()); myHistory.back(); assertTrue(myHistory.isBackAvailable()); assertTrue(myHistory.isForwardAvailable()); assertSame(myState2, myEditorState); myHistory.back(); assertFalse(myHistory.isBackAvailable()); assertT...
testSimpleNavigation
270,608
void () { pushTwoStates(); myHistory.back(); assertTrue(myHistory.isBackAvailable()); assertTrue(myHistory.isForwardAvailable()); MyState newState = new MyState(false, "newState"); makeNavigationChange(newState); assertTrue(myHistory.isBackAvailable()); assertFalse(myHistory.isForwardAvailable()); myHistory.back(); ass...
testQueueCutOff
270,609
void () { pushTwoStates(); assertTrue(myHistory.isBackAvailable()); mySelectedFile.myValid = false; myHistory.removeInvalidFilesFromStacks(); assertFalse(myHistory.isBackAvailable()); assertFalse(myHistory.isForwardAvailable()); }
testRemoveInvalid
270,610
void () { myState1 = new MyState(false, "state1"); myState2 = new MyState(false, "state2"); myState3 = new MyState(false, "state3"); myEditorState = myState1; makeNavigationChange(myState2); makeNavigationChange(myState3); }
pushTwoStates
270,611
void (MyState newState) { myHistory.onCommandStarted(); myHistory.onSelectionChanged(); myHistory.onCommandFinished(getProject(), null); myEditorState = newState; }
makeNavigationChange
270,612
FileEditorComposite (@NotNull VirtualFile file, @Nullable EditorWindow window, @NotNull FileEditorOpenOptions options) { return FileEditorComposite.Companion.fromPair(new Pair<>(new FileEditor[]{mySelectedEditor}, new FileEditorProvider[]{myProvider})); }
openFile
270,613
FileEditorProvider (FileEditor editor) { return myProvider; }
getProvider
270,614
boolean (@NotNull FileEditorState otherState, @NotNull FileEditorStateLevel level) { return myCanBeMerged; }
canBeMergedWith
270,615
String () { return myName; }
toString
270,616
void () { for (Splitter.LackOfSpaceStrategy strategy : Splitter.LackOfSpaceStrategy.values()) { { Splitter splitter = new Splitter(true); splitter.setLackOfSpaceStrategy(strategy); resizeTest(splitter); } { Splitter splitter = new Splitter(false); splitter.setLackOfSpaceStrategy(strategy); resizeTest(splitter); } } }
testAll
270,617
void (Splitter splitter) { JPanel jPanel1 = new JPanel(); jPanel1.setMinimumSize(new Dimension(100, 100)); jPanel1.setPreferredSize(new Dimension(100, 100)); JPanel jPanel2 = new JPanel(); jPanel2.setMinimumSize(new Dimension(100, 100)); jPanel2.setPreferredSize(new Dimension(100, 100)); splitter.setFirstComponent(jPan...
resizeTest
270,618
void (Splitter splitter) { Dimension firstSize = splitter.getFirstComponent().getSize(); Dimension secondSize = splitter.getSecondComponent().getSize(); if (splitter.getOrientation()) { assertTrue(firstSize.height >= 0 && secondSize.height >= 0); } else { assertTrue(firstSize.width >= 0 && secondSize.width >= 0); } // ...
checkBounds
270,619
void (String[] args) { final JFrame frame = new JFrame(); frame.getContentPane().setLayout(new BorderLayout()); final JPanel content = new JPanel(new BorderLayout()); final DetailsComponent d = new DetailsComponent(); content.add(d.getComponent(), BorderLayout.CENTER); d.setText("This is a Tree"); final JTree c = new T...
main
270,620
void (final ActionEvent e) { d.setDetailsModeEnabled(details.isSelected()); }
actionPerformed
270,621
void () { assertThat(new LineTokenizer("a\nb\n\rc\rd\r\n").execute()).containsExactly("a\n", "b\n", "c\n", "d\n"); assertThat(new LineTokenizer("a\nb").execute()).containsExactly("a\n", "b"); LineTokenizer lineTokenizer = new LineTokenizer("a\n\r\r\nb"); assertThat(lineTokenizer.execute()).containsExactly("a\n", "\n", ...
test
270,622
String (@TestDataFile String dirName) { return PlatformTestUtil.getPlatformTestDataPath() + "diff/applyPatch/" + dirName; }
getTestDir
270,623
void (final List<? extends FilePatch> patches, final int skipDirs) { if (skipDirs < 1) { return; } for (FilePatch patch : patches) { patch.setBeforeName(skipN(patch.getBeforeName(), skipDirs)); patch.setAfterName(skipN(patch.getAfterName(), skipDirs)); } }
applySkipDirs
270,624
String (final String path, final int num) { final String[] pieces = path.split("/"); final StringBuilder sb = new StringBuilder(); for (int i = num; i < pieces.length; i++) { final String piece = pieces[i]; sb.append('/').append(piece); } return sb.toString(); }
skipN
270,625
boolean (VirtualFile file) { try { if (file.getName().equals("cyr1.txt")) { //noinspection NonAsciiCharacters file.rename(ApplyPatchTest.class, "имя файла.txt"); } if (file.getName().equals("cyr2.txt")) { //noinspection NonAsciiCharacters file.rename(ApplyPatchTest.class, "кириллица.txt"); } return true; } catch (IOExc...
useCyrillicNames
270,626
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testSeveralSteps
270,627
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2a")); patchHun...
testExchangedParts
270,628
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testDeleteAlmostOk
270,629
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "4")); patchHunk.a...
testInsertAlmostOk
270,630
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "4")); patchHunk.a...
testInsertAlmostOkAlreadyApplied
270,631
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testChangeAlmostOk
270,632
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testChangeAlmostOkAlreadyApplied
270,633
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "-1")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "-1a")); patch...
testChangeAlmostOkManySteps
270,634
void () { final PatchHunk patchHunk = new PatchHunk(1, 2, 1, 3); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); AppliedPatch result = GenericPatchApplier.apply("1\n2\n", Collections.s...
testFirstNewLine
270,635
void () { final PatchHunk patchHunk = new PatchHunk(0, 2, 0, 2); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "2")); PatchLine line = new PatchLine(PatchLine.Type.ADD, "2"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedPatch resu...
testRemovedLastNewLine
270,636
void () { final PatchHunk patchHunk = new PatchHunk(0, 1, 0, 3); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "y")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "x")); PatchLine line = new PatchLine(PatchLine.Type.ADD, "z"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedPatch result ...
testInvalidPatchApplicationRegression1
270,637
void () { // IDEA-189699 final PatchHunk patchHunk = new PatchHunk(0, 4, 0, 7); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "X")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "...
testInvalidPatchApplicationRegression2
270,638
void () { final PatchHunk patchHunk = new PatchHunk(0, 2, 0, 2); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2")); PatchLine line = new PatchLine(PatchLine.Type.REMOVE, "2"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedPatch resu...
testInsertedLastNewLine
270,639
void () { final PatchHunk patchHunk = new PatchHunk(1, 3, 1, 4); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "0")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); AppliedP...
testNewEmptyLine
270,640
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append(i + 1).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("5", "6", "7"); // coincidence gap.putCutIntoTransformations...
testInsertionsIntoTransformationsCoinsidence
270,641
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append(i + 1).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("5", "6", "ins", "7"); // coincidence gap.putCutIntoTransfor...
testInsertionsIntoTransformationsInsert
270,642
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append(i + 1).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("ins", "5", "6", "7"); // coincidence gap.putCutIntoTransfor...
testInsertionsIntoTransformationsInsert0
270,643
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append(i + 1).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("5", "6", "7", "ins"); // coincidence gap.putCutIntoTransfor...
testInsertionsIntoTransformationsInsert1
270,644
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append(i + 1).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("5", "7"); // coincidence gap.putCutIntoTransformations(new ...
testInsertionsIntoTransformationsDeletion
270,645
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append((i + 1)).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("5", "6"); // coincidence gap.putCutIntoTransformations(ne...
testInsertionsIntoTransformationsDeletion1
270,646
void () { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < 20; i++) { sb.append((i + 1)).append('\n'); } final GenericPatchApplier gap = new GenericPatchApplier(sb.toString(), Collections.emptyList()); final List<String> strings = Arrays.asList("6", "7"); // coincidence gap.putCutIntoTransformations(ne...
testInsertionsIntoTransformationsDeletion0
270,647
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testBetterContextMatch
270,648
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testBetterContextMatch1
270,649
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "4")); patch...
testBetterContextMatch2
270,650
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "-1")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "-1a")); patch...
testFromSecondLineManySteps
270,651
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "-1")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "-1*")); pa...
testFromSecondLineManySteps0
270,652
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "3c")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "2r")); ...
testMoreInsertParts
270,653
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2c")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "3c")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "2r")); pat...
testMoreDeletionParts
270,654
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3")); patch...
testDoesNotMatchInTheEnd
270,655
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3=")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3-")); pat...
testDoesNotMatchAtStart
270,656
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); final PatchLine line = new PatchLine(PatchLine.Type.ADD, "5"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedPatch result = GenericPatchApplier.apply("", Collections.singletonList(patchHunk)); Assert.assertNotNull(result); Assert.assertEq...
testOneLineInsertion
270,657
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); final PatchLine line = new PatchLine(PatchLine.Type.ADD, "5"); line.setSuppressNewLine(true); patchHunk.addLine(line); AppliedSomehowPatch result = GenericPatchApplier.applySomehow("7\n8\n5\n", Collections.singletonList(patchHunk)); Assert.assertTrue(resu...
testOneLineBadInsertion
270,658
void () { final PatchHunk patchHunk = new PatchHunk(1, 8, 1, 8); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "3=")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "5")); patchHu...
testConflict1
270,659
void () { int[] beforeOfsetExpected = {1, 1}; int[] afterOfsetExpected = {1, 2}; final PatchHunk patchHunk = new PatchHunk(1, 4, 1, 5); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "5")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "7")); patchHunk.addLine(new PatchLine(PatchLine.Type.REMOVE, "8")); ...
testAddAsFirst
270,660
void () { final PatchHunk patchHunk1 = new PatchHunk(1, 2, 1, 1); patchHunk1.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk1.addLine(new PatchLine(PatchLine.Type.REMOVE, "2")); int[] beforeOfsetExpected = {3, 7, 9, 11}; int[] afterOfsetExpected = {2, 6, 7, 9}; final PatchHunk patchHunk2 = new PatchHunk(...
testOffsets
270,661
void () { int[] beforeAppliedExpected = {2, 5, 6, 8}; int[] endAppliedExpected = {4, 5, 7, 10}; final PatchHunk patchHunk = new PatchHunk(2, 12, 2, 12); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(PatchLine...
testAlreadyApplied
270,662
void () { int[] beforeAppliedExpected = {5, 8, 10, 12}; int[] afterAppliedExpected = {7, 9, 11, 12}; final PatchHunk patchHunk = new PatchHunk(2, 12, 2, 12); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "1")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "2")); patchHunk.addLine(new PatchLine(Patc...
testExactlyApplied
270,663
void () { final PatchHunk patchHunk = new PatchHunk(2, 9, 2, 12); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c2")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c2")); patchHunk.addLine(new PatchLine(PatchLine.Type.CONTEXT, "c3")); patchHunk.addLine(new PatchLine(PatchLine.Type.ADD, "a1")); pa...
testMatchBeforeStartOffset
270,664
void (int[] beforeAppliedExpected, int[] endAppliedExpected, HunkStatus expectedStatus, List<AppliedTextPatch.AppliedSplitPatchHunk> appliedInfo) { for (int i = 0; i < appliedInfo.size(); i++) { final AppliedTextPatch.AppliedSplitPatchHunk hunk = appliedInfo.get(i); assertEquals(beforeAppliedExpected[i], hunk.getApplie...
checkAppliedPositions
270,665
String (@TestDataFile String dirName) { return PlatformTestUtil.getPlatformTestDataPath() + "diff/patch/" + dirName; }
getTestDir
270,666
MockContentRevision (@Nullable File file, @NotNull String revision, boolean relativePaths) { if (file == null) return null; String path = file.getPath(); if (relativePaths) { path = FileUtil.toSystemIndependentName(path).replace("/before/", "/"); path = FileUtil.toSystemIndependentName(path).replace("/after/", "/"); } ...
createRevision
270,667
FilePath () { return myFilePath; }
getFile
270,668
VcsRevisionNumber () { return this; }
getRevisionNumber
270,669
String () { return myRevisionName; }
asString
270,670
int (final VcsRevisionNumber o) { return 0; }
compareTo
270,671
void () { assertEquals("file:/C:/Temp/README.txt", VfsUtilCore.fixIDEAUrl("file://C:/Temp/README.txt")); assertEquals("file:/C:/Temp/README.txt", VfsUtilCore.fixIDEAUrl("file:///C:/Temp/README.txt")); assertEquals("file:/tmp/foo.bar", VfsUtilCore.fixIDEAUrl("file:///tmp/foo.bar")); }
testFixIdeaUrl
270,672
void () { File tempDir = this.tempDir.newDirectory(); VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDir); assertNotNull(vDir); assertTrue(vDir.isDirectory()); VirtualFile child = vDir.findChild(" "); assertNull(child); assertThat(vDir.getChildren()).isEmpty(); }
testFindChildWithTrailingSpace
270,673
void () { if (!SystemInfo.isWindows) { assertEquals("file:///asd", VfsUtil.toUri(new File("/asd")).toASCIIString()); assertEquals("file:///asd%20/sd", VfsUtil.toUri(new File("/asd /sd")).toASCIIString()); } URI uri = VfsUtil.toUri("file:///asd"); assertNotNull(uri); assertEquals("file", uri.getScheme()); assertEquals("...
testToUri
270,674
void () { assertTrue(VfsUtilCore.isEqualOrAncestor("file:///my/dir", "file:///my/dir")); assertTrue(VfsUtilCore.isEqualOrAncestor("file:///my/dir", "file:///my/dir/file.txt")); assertTrue(VfsUtilCore.isEqualOrAncestor("file:///my/dir/", "file:///my/dir/file.txt")); assertFalse(VfsUtilCore.isEqualOrAncestor("file:///my/...
testIsAncestor
270,675
void () { File tempJar = IoTestUtil.createTestJar(tempDir.newFile("test.jar")); VirtualFile jar = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempJar); assertNotNull(jar); NewVirtualFile root1 = ManagingFS.getInstance().findRoot(jar.getPath() + "!/", JarFileSystem.getInstance()); NewVirtualFile root2 = Man...
testFindRootWithDenormalizedPath
270,676
void () { for (int i = 0; i < 10; i++) { String path = StringUtil.repeat("/", i); VirtualFile root = LocalFileSystem.getInstance().findFileByPathIfCached(path); assertTrue(path, root == null || !root.getPath().contains("//")); VirtualFile root2 = LocalFileSystem.getInstance().findFileByPath(path); assertTrue(path, root...
testFindRootWithCrazySlashes
270,677
void () { EdtTestUtil.runInEdtAndWait(() -> { VirtualDirectoryImpl vTemp = (VirtualDirectoryImpl)LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDir.getRoot()); assertThat(vTemp.getChildren()).isEmpty(); tempDir.newFile("x.txt"); ProgressManager.getInstance().run(new Task.Modal(null, "", false) { @Override...
asyncRefreshInModalProgressCompletesWithinIt
270,678
void (@NotNull ProgressIndicator indicator) { ApplicationManager.getApplication().assertIsNonDispatchThread(); Semaphore semaphore = new Semaphore(1); vTemp.refresh(true, true, semaphore::up); assertTrue(semaphore.waitFor(10_000)); assertThat(vTemp.getChildren()).hasSize(1); }
run
270,679
void (@NotNull ProgressIndicator indicator) { ApplicationManager.getApplication().assertIsNonDispatchThread(); Semaphore local = new Semaphore(1); vDir2.refresh(true, true, () -> { log.add("modal finished"); local.up(); }); assertTrue(local.waitFor(10_000)); assertThat(vDir2.getChildren()).hasSize(1); }
run
270,680
void () { String wslName = IoTestUtil.assumeWorkingWslDistribution(); File usrBinFile = new File("\\\\wsl$\\" + wslName + "\\usr\\bin\\"); assertTrue(usrBinFile + " doesn't exist", usrBinFile.exists()); VirtualFile usrBin = LocalFileSystem.getInstance().findFileByIoFile(usrBinFile); assertTrue(VfsUtilCore.pathEqualsTo(...
pathEqualsWorksForWslPaths
270,681
void () { File jarFile = IoTestUtil.createTestJar(tempDir.newFile("test.jar")); assertNotNull(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(jarFile)); VirtualFile jarRoot = VirtualFileManager.getInstance().findFileByUrl("jar://" + FileUtil.toSystemIndependentName(jarFile.getPath()) + "!/"); assertNotNull(jar...
testGetPathForVFileCreateEventForJarReturnsNormalizedPathSeparators
270,682
void (@NotNull VirtualFileEvent e) { events[0] = e; }
beforeFileDeletion
270,683
void (@NotNull VirtualFileEvent e) { events[1] = e; }
fileDeleted
270,684
void () { ApplicationManagerEx.setInStressTest(true); }
setupInStressTestsFlag
270,685
void () { ApplicationManagerEx.setInStressTest(false); }
clearInStressTestsFlag
270,686
void () { File tempJar = IoTestUtil.createTestJar(tempDir.newFile("test.jar")); VirtualFile jar = LocalFileSystem.getInstance().findFileByIoFile(tempJar); assertNotNull(jar); JarFileSystem fs = JarFileSystem.getInstance(); String path = jar.getPath() + "!/"; ManagingFS managingFS = ManagingFS.getInstance(); NewVirtualF...
testFindRootPerformance
270,687
void () { for (int i = 0; i < N; i++) checkRootReached(); }
run
270,688
void () { assertTrue(findRoot(leafDir, root)); }
checkRootReached
270,689
boolean (VirtualFile file, VirtualFile root) { while (true) { VirtualFile parent = file.getParent(); if (parent == null) return false; if (root.equals(parent)) return true; file = parent; } }
findRoot
270,690
void () { //RC: adding .warmupIterations(1-2) reduce execution time 5-10x! Probably, // because of JITing -- if that is true, then times after warm up are // better represent real-life performance? int N = 30_000; List<VFileEvent> events = new ArrayList<>(N); VirtualDirectoryImpl temp = createTempFsDirectory(); EdtTest...
PersistentFS_performance_ofManyFilesCreateDelete
270,691
VirtualDirectoryImpl () { VirtualFile root = TempFileSystem.getInstance().findFileByPath("/"); VirtualDirectoryImpl temp = (VirtualDirectoryImpl)VfsTestUtil.createDir(root, "temp"); Disposer.register(getTestRootDisposable(), () -> VfsTestUtil.deleteFile(temp)); return temp; }
createTempFsDirectory
270,692
void (List<VFileEvent> events) { WriteCommandAction.runWriteCommandAction(null, () -> RefreshQueue.getInstance().processEvents(false, events)); }
processEvents
270,693
void (List<VFileEvent> events, VirtualDirectoryImpl temp) { events.clear(); temp.getCachedChildren().stream() .map(v->new VFileDeleteEvent(this, v)) .forEach(events::add); }
eventsForDeleting
270,694
void () { myRoot = dir("/", dir("A", dir("B", file("f")), dir("C", file("f")), file("f"))); }
setUp
270,695
void () { myRoot = null; }
tearDown
270,696
void (String srcPath, String dstPath, String expected) { VirtualFile src = myRoot.findFileByRelativePath(srcPath); assertNotNull(srcPath, src); VirtualFile dst = myRoot.findFileByRelativePath(dstPath); assertNotNull(dstPath, dst); assertEquals(expected, VfsUtilCore.findRelativePath(src, dst, '/')); }
assertRelativePath
270,697
void () { for (var name : Arrays.asList(null, "", ".", "..", "/", "\\", "a/b", "c\\d")) { assertTrue("name: '" + name + "'", VfsUtil.isBadName(name)); } }
isBadName
270,698
void (@NotNull VirtualFileEvent event) { eventFired.set(true); }
fileCreated
270,699
void () { assertEquals(null, VirtualFileManager.extractProtocol("")); assertEquals(null, VirtualFileManager.extractProtocol("file:/")); assertEquals("file", VirtualFileManager.extractProtocol("file://")); assertEquals("file", VirtualFileManager.extractProtocol("file:///some/path/file.rb:24")); assertEquals("file", Virt...
testExtractProtocol