Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
300,300 | void () { String s1 = "<a><b>\nSomeDataHere"; String s2 = "\n</b></a>"; prepareFile(s1, s2); PsiElement element1 = ((XmlFile)myDummyFile).getDocument().getRootTag(); insert("x"); insert(" "); insert("xxxxx"); insert("\n"); insert("xxxxx"); assertSame(element1, ((XmlFile)myDummyFile).getDocument().getRootTag()); } | testTagData2 |
300,301 | void () { String s1 = "<a><b>"; String s2 = "</b></a>"; prepareFile(s1, s2); insert("<"); insert("c"); insert("/"); insert(">"); } | testTagInTag1 |
300,302 | void () { String s1 = "<a><b>"; String s2 = "</b></a>"; prepareFile(s1, s2); insert("<"); insert("c"); insert(">"); insert("\nxxx \nxxxx\n"); insert("<"); insert("/"); insert("c"); insert(">"); } | testTagInTag2 |
300,303 | void () { String s1 = "<a><b>"; String s2 = "</b></a>"; prepareFile(s1, s2); insert("<"); insert("/"); insert("b"); insert(">"); } | testTagInTag3 |
300,304 | void () { String s1 = "<one> <two "; String s2 = ",b\"/></one>"; prepareFile(s1, s2); insert("a"); insert("t"); insert("t"); insert("r"); insert("="); insert("\""); } | testSCR5925 |
300,305 | void (Document document) { int i = document.getText().indexOf(marker); if (i==-1) return; WriteCommandAction.runWriteCommandAction(getProject(), () -> document.replaceString(i, i + marker.length(), "")); removeGarbage(document); } | removeGarbage |
300,306 | String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; } | getTestDataPath |
300,307 | void () { setFileType(XmlFileType.INSTANCE); String text2 = "</root>"; final String text1 = "<root>/n"; prepareFile(text1, text2); insert("<"); PsiElement element = myDummyFile.findElementAt(10); assert element != null; assertNotNull(element.getTextRange()); } | testXml |
300,308 | void () { setFileType(XmlFileType.INSTANCE); String text1 = "<rf oot><xc></root>"; String text2 = "<root><f xc></root>"; // moved "f " to another place prepareFile(text1, ""); Document document = myDummyFile.getViewProvider().getDocument(); WriteCommandAction.runWriteCommandAction(getProject(), () -> { ((XmlFile)myDummyFile).getRootTag().replace(XmlElementFactory.getInstance(getProject()).createTagFromText(text2)); }); PsiTestUtil.checkFileStructure(myDummyFile); assertEquals(text2, myDummyFile.getText()); assertEquals(text2, document.getText()); } | testNoExceptionsDummyIdentifierMovementWithSpace |
300,309 | XmlTag (String subTag, String withValue, String forTag, XmlTag insideRoot) { final XmlTag[] forTags = insideRoot.findSubTags(forTag); for (XmlTag tag : forTags) { final XmlTag[] allTags = tag.findSubTags(subTag); for (XmlTag curTag : allTags) { if (curTag.getName().equals(subTag) && curTag.getValue().getTrimmedText().equalsIgnoreCase(withValue)) { return tag; } } } return null; } | find |
300,310 | XmlTag (@NonNls String tagName, Project project) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(project).createFileFromText("tag.xml", "<" + tagName + "/>"); return file.getDocument().getRootTag(); } | tag |
300,311 | XmlTag (@NonNls String tagName, @NonNls String namespace, Project project) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(project) .createFileFromText("tag.xml", "<" + tagName + " xmlns=\"" + namespace + "\"/>"); return file.getDocument().getRootTag(); } | tag |
300,312 | String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData"; } | getXmlTestDataPath |
300,313 | String () { return "performance/"; } | getBasePath |
300,314 | String () { return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/"; } | getTestDataPath |
300,315 | void () { @SuppressWarnings({"UnusedDeclaration"}) Class clazz = IdeaTestUtil.class; } | testDummy |
300,316 | void () { doIndentTest(2000); } | testIndentUnindent |
300,317 | void () { doIndentTest(2001); } | testIndentUnindent2 |
300,318 | boolean () { return ourTestsWithFolding.contains(getTestName(false)); } | doFolding |
300,319 | void (int time) { configureByFile(getBasePath() + getTestName(false)+".xml"); doHighlighting(); getEditor().getSelectionModel().setSelection(0, getEditor().getDocument().getTextLength()); PlatformTestUtil.startPerformanceTest("indent/unindent "+time, time, () -> { EditorActionManager.getInstance().getActionHandler("EditorIndentSelection").execute(getEditor(), null, DataManager.getInstance().getDataContext()); EditorActionManager.getInstance().getActionHandler("EditorUnindentSelection").execute(getEditor(), null, DataManager.getInstance().getDataContext()); }).useLegacyScaling().assertTiming(); final int startOffset = getEditor().getCaretModel().getOffset(); getEditor().getSelectionModel().setSelection(startOffset, startOffset); checkResultByFile(getBasePath() + getTestName(false)+".xml"); } | doIndentTest |
300,320 | String () { return XmlTestUtil.getXmlTestDataPath(); } | getTestDataPath |
300,321 | void () { configureByFile("/codeInsight/commentByBlock/xml/before1.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/after1.xml"); } | testXml1 |
300,322 | void () { configureByFile("/codeInsight/commentByBlock/xml/before2.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/after2.xml"); } | testXml2 |
300,323 | void () { doTest(); } | test3 |
300,324 | void () { doTest(); } | testDoubleDash |
300,325 | void () { doTest(false); } | testSingleDash |
300,326 | void () { doTest(); } | testSelfClosing |
300,327 | void () { doTest(false); doTest(true); } | doTest |
300,328 | void (boolean invert) { String test = getTestName(false); String before = invert ? "after" : "before"; configureByFile("/codeInsight/commentByBlock/xml/" + before + test + ".xml"); performAction(); String after = invert ? "before" : "after"; checkResultByFile("/codeInsight/commentByBlock/xml/" + after + test + ".xml"); } | doTest |
300,329 | void () { configureByFile("/codeInsight/commentByBlock/html/before1.html"); performAction(); checkResultByFile("/codeInsight/commentByBlock/html/after1.html"); } | testHtml1 |
300,330 | void () { configureByFile("/codeInsight/commentByBlock/html/before2.html"); performAction(); checkResultByFile("/codeInsight/commentByBlock/html/after2.html"); } | testHtml2 |
300,331 | void () { configureByFile("/codeInsight/commentByBlock/xml/before4.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/after4.xml"); } | testNestedXml |
300,332 | void () { configureByFile("/codeInsight/commentByBlock/html/before3.html"); performAction(); checkResultByFile("/codeInsight/commentByBlock/html/after3.html"); } | testNestedHtml |
300,333 | void () { configureByFile("/codeInsight/commentByBlock/xml/before5.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/after5.xml"); } | testRightUncommentBoundsXml |
300,334 | void () { configureByFile("/codeInsight/commentByBlock/xml/beforeIdeaDev25498_1.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/afterIdeaDev25498_1.xml"); } | testIdeaDev25498_1 |
300,335 | void () { configureByFile("/codeInsight/commentByBlock/xml/beforeIdeaDev25498_2.xml"); performAction(); checkResultByFile("/codeInsight/commentByBlock/xml/afterIdeaDev25498_2.xml"); } | testIdeaDev25498_2 |
300,336 | void () { EditorTestUtil.executeAction(getEditor(), IdeActions.ACTION_COMMENT_BLOCK); } | performAction |
300,337 | void () { assertEquals("bar", createTag("bar").getValue().getText()); } | testGetTextValue |
300,338 | void () { String[] names = XmlTagUtil.getCharacterEntityNames(); for (String name : names) { XmlTag tag = createTag("foo&" + name + ";bar"); assertEquals("foo" + XmlTagUtil.getCharacterByEntityName(name) + "bar", tag.getValue().getTrimmedText()); } } | testCharRefs |
300,339 | void () { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo xmlns='aaa' xmlns:a='bbbb'/>"); final Object[] nsPrefixes = ArrayUtil.toObjectArray(tag.getLocalNamespaceDeclarations().keySet()); Arrays.sort(nsPrefixes); assertEquals(2, nsPrefixes.length); assertEquals("a",nsPrefixes[1]); assertEquals("",nsPrefixes[0]); } | testLocalNSDeclarations |
300,340 | void () { XmlTag tag = createTag("foo<![CDATA[<>&'\"]]>bar"); assertEquals("foo<>&'\"bar", tag.getValue().getTrimmedText()); } | testCDATA |
300,341 | void () { XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a c=d>b</a>"); assertEquals("b", tag.getValue().getText()); } | testWhitespacesInAttributes |
300,342 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a xmlns=\"aNamespace\"/>"); final XmlTag childTag = rootTag.createChildTag("b", "bNamespace", null, true); assertEquals("bNamespace", childTag.getNamespace()); WriteCommandAction.runWriteCommandAction(null, () -> { XmlTag beanTag = (XmlTag)rootTag.add(childTag); assertEquals("bNamespace", beanTag.getNamespace()); }); } | testCreateChildTag |
300,343 | void () { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/> </a>"); final XmlTag bTag = aTag.findFirstSubTag("b"); WriteCommandAction.runWriteCommandAction(null, () -> bTag.delete()); assertEquals(0, aTag.getSubTags().length); } | testDeleteTag |
300,344 | void () { final XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/></a>"); final XmlTag bTag = aTag.findFirstSubTag("b"); WriteCommandAction.runWriteCommandAction(null, () -> { PsiElement cTag = bTag.replace(XmlElementFactory.getInstance(getProject()).createTagFromText("<c/>")); assertEquals(1, aTag.getSubTags().length); assertEquals(cTag, aTag.getSubTags()[0]); }); } | testReplaceTag |
300,345 | void () { final XmlElementFactory elementFactory = XmlElementFactory.getInstance(getProject()); final XmlTag aTag = elementFactory.createTagFromText("<a>1</a>"); final XmlText displayText = elementFactory.createDisplayText("2"); WriteCommandAction.runWriteCommandAction(null, () -> { final PsiElement psiElement = aTag.addAfter(displayText, aTag.getValue().getChildren()[0]); assertEquals(psiElement.getContainingFile(), aTag.getContainingFile()); }); } | testAddText |
300,346 | void () { WriteCommandAction.runWriteCommandAction(null, () -> XmlElementFactory.getInstance(getProject()).createTagFromText("<p/>").getValue().setText("\n")); } | testWhitespaceInsideTag |
300,347 | void () { XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xhtml", "<html/>"); final XmlTag rootTag = xhtmlFile.getDocument().getRootTag(); WriteCommandAction.runWriteCommandAction(null, () -> { rootTag.setAttribute("foo", "bar"); }); assertEquals(1, rootTag.getAttributes().length); assertEquals("bar", rootTag.getAttributeValue("foo")); assertEquals("foo", rootTag.getAttributes()[0].getName()); } | testSetAttribute_ForXhtml |
300,348 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>"); WriteCommandAction.runWriteCommandAction(null, () -> { rootTag.setAttribute("foo", "bar"); }); assertEquals(1, rootTag.getAttributes().length); assertEquals("bar", rootTag.getAttributeValue("foo")); assertEquals("foo", rootTag.getAttributes()[0].getName()); assertEquals("<html foo=\"bar\"/>", rootTag.getText()); } | testSetAttribute |
300,349 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>"); final String value = "a \"b\" c"; WriteCommandAction.runWriteCommandAction(null, () -> { rootTag.setAttribute("foo", value); }); assertEquals(1, rootTag.getAttributes().length); assertEquals(value, rootTag.getAttributeValue("foo")); assertEquals("foo", rootTag.getAttributes()[0].getName()); assertEquals("<html foo='" + value + "'/>", rootTag.getText()); } | testSetAttributeWithQuotes |
300,350 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html/>"); final String value = "'a \"b\" c'"; WriteCommandAction.runWriteCommandAction(null, () -> { rootTag.setAttribute("foo", value); }); final String expected = value.replaceAll("\"", """); assertEquals(1, rootTag.getAttributes().length); assertEquals(expected, rootTag.getAttributeValue("foo")); assertEquals(value, rootTag.getAttribute("foo").getDisplayValue()); assertEquals("foo", rootTag.getAttributes()[0].getName()); assertEquals("<html foo=\"" + expected + "\"/>", rootTag.getText()); } | testSetAttributeWithQuotes2 |
300,351 | void () { final String value = "a \"b\" c"; final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html foo='" + value + "'/>"); assertEquals(1, rootTag.getAttributes().length); assertEquals(value, rootTag.getAttributeValue("foo")); final XmlAttribute foo = rootTag.getAttribute("foo"); final String text = foo.getValueElement().getText(); assertEquals("'" + value + "'", text); ((PsiLanguageInjectionHost)foo.getValueElement()).updateText(text); assertEquals("<html foo='" + value + "'/>", rootTag.getText()); } | testSetAttributeUpdateText |
300,352 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<ns:tag xmlns:ns=\"xxx\"/>"); WriteCommandAction.runWriteCommandAction(null, () -> { rootTag.setAttribute("foo", "", "bar"); }); assertEquals(2, rootTag.getAttributes().length); assertEquals("bar", rootTag.getAttributeValue("foo")); assertEquals("foo", rootTag.getAttributes()[1].getName()); assertEquals("<ns:tag xmlns:ns=\"xxx\" foo=\"bar\"/>", rootTag.getText()); } | testSetAttributeWithNamespaces |
300,353 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(0, 3)); assertEquals("<html></html>", rootTag.getText()); } | testTextEdit1 |
300,354 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<a</html>"); WriteCommandAction.runWriteCommandAction(null, () -> rootTag.getValue().getTextElements()[0].removeText(0, 3)); assertEquals("<html></html>", rootTag.getText()); } | testTextEdit2 |
300,355 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<a</html>"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(1, 2)); assertEquals(1, xmlText.getChildren().length); assertEquals("<html>aa</html>", rootTag.getText()); } | testTextEdit3 |
300,356 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>aaa</html>"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; WriteCommandAction.runWriteCommandAction(null, () -> xmlText.removeText(1, 2)); assertEquals(1, xmlText.getChildren().length); assertEquals("<html>aa</html>", rootTag.getText()); } | testTextEdit4 |
300,357 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html><x>xxx</x>\n<y>yyy</y></html>"); final XmlTag y = rootTag.findFirstSubTag("y"); final PsiFile file = y.getContainingFile(); String text = y.getValue().getText(); TextRange textRange = y.getValue().getTextRange(); assertEquals(text, textRange.substring(file.getText())); WriteCommandAction.writeCommandAction(getProject(), file).run(() -> CodeStyleManager.getInstance(getProject()).adjustLineIndent(file, y.getTextOffset())); text = y.getValue().getText(); textRange = y.getValue().getTextRange(); assertEquals(text, textRange.substring(file.getText())); } | testTextEdit5 |
300,358 | void () { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<html>a<b>1</b>c</html>"); final XmlTag xmlTag = rootTag.findFirstSubTag("b"); WriteCommandAction.runWriteCommandAction(null, () -> xmlTag.delete()); assertEquals("<html>ac</html>", rootTag.getText()); } | testTextEdit6 |
300,359 | void () { final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>"); WriteCommandAction.runWriteCommandAction(null, () -> tagFromText.getValue().setText("<")); assertEquals("<", tagFromText.getValue().getTextElements()[0].getValue()); } | testBrace |
300,360 | void () { final String text = "<a></a>"; final String name = "test.xhtml"; XmlTag rootTag = createTag(name, text); TextRange textRange = rootTag.getValue().getTextRange(); assertEquals(3, textRange.getStartOffset()); assertEquals(3, textRange.getEndOffset()); } | testEmptyTextRange |
300,361 | void () { final XmlTag tag = createTag("foo.xhtml", "<p>a<div/>b</p>"); final XmlTag div = tag.getSubTags()[0]; WriteCommandAction.writeCommandAction(getProject(), tag.getContainingFile()).run(() -> div.delete()); assertEquals("<p>ab</p>", tag.getText()); } | testDeleteTagBetweenText |
300,362 | XmlTag (final String name, final String text) { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText(name, XmlFileType.INSTANCE, text, LocalTimeCounter.currentTime(), true); return file.getDocument().getRootTag(); } | createTag |
300,363 | void () { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(" <foo/>"); WriteCommandAction.runWriteCommandAction(null, () -> { tag.add(XmlElementFactory.getInstance(getProject()).createDisplayText("aaa\nbbb")); }); assertEquals("aaa\nbbb", tag.getValue().getTextElements()[0].getValue()); } | testDisplayText |
300,364 | void () { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xhtml", "<a>a <b>123</b> c</a>"); final XmlTag tagB = file.getDocument().getRootTag().findFirstSubTag("b"); final XmlTagChild[] tagElements = tagB.getValue().getChildren(); final PsiElement parent = tagB.getParent(); WriteCommandAction.runWriteCommandAction(null, () -> { PsiElement first = parent.addBefore(tagElements[0], tagB); assertNotNull(first); }); } | testXHTMLAddBefore1 |
300,365 | void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xhtml", "<a/>"); final XmlTag tagB = file.getDocument().getRootTag(); tagB.setAttribute("a", ""); assertEquals("<a a=\"\"/>", tagB.getText()); tagB.setAttribute("b", ""); assertEquals("<a a=\"\" b=\"\"/>", tagB.getText()); tagB.setAttribute("c", ""); assertEquals("<a a=\"\" b=\"\" c=\"\"/>", tagB.getText()); tagB.getAttributes()[1].delete(); assertEquals("<a a=\"\" c=\"\"/>", tagB.getText()); }); } | testXHTMLSetAttribute1 |
300,366 | void () { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xhtml", "<a> </a>"); final XmlTag tagB = file.getDocument().getRootTag(); assertEquals(tagB.getValue().getTextElements().length, 1); assertEquals(tagB.getValue().getTextElements()[0].getValue(), "\u00a0"); } | testXHTMLNbsp1 |
300,367 | void () { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("test.xml", "<a>\n <a/>\n</a>"); final XmlTag tagB = file.getDocument().getRootTag(); ApplicationManager.getApplication().runWriteAction(() -> tagB.getSubTags()[0].delete()); assertEquals("<a>\n </a>", tagB.getText()); } | testDeleteTagWithMultilineWhitespace1 |
300,368 | void () { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText("test.xml", "<a>\n <a>\n <b>\n hasgdgasjdgasdg asgdjhasgd</b>\n </a>\n</a>"); final XmlTag tagB = file.getDocument().getRootTag(); WriteCommandAction.runWriteCommandAction(null, () -> tagB.getSubTags()[0].getSubTags()[0].delete()); assertEquals("<a>\n <a>\n </a>\n</a>", tagB.getText()); } | testDeleteTagWithMultilineWhitespace2 |
300,369 | void () { XmlTag tag = createTag("file.xhtml", "<a>xyz</a>"); PsiFile psiFile = tag.getContainingFile(); Document document = PsiDocumentManager.getInstance(psiFile.getProject()).getDocument(psiFile); RangeMarker rangeMarker = document.createRangeMarker(5, 5); final XmlText text = (XmlText) tag.getValue().getChildren()[0]; ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { try{ text.removeText(2, 3); } catch(IncorrectOperationException ioe){} }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); assertEquals(5, rangeMarker.getStartOffset()); assertEquals(5, rangeMarker.getEndOffset()); } | testXHTMLRangeMarkers2 |
300,370 | void () { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a>xyz</a>"); ApplicationManager.getApplication().runWriteAction(() -> tag.getValue().getTextElements()[0].insertText("<", 1)); assertEquals("<a>x<yz</a>", tag.getText()); } | testXHTMLTextInsert |
300,371 | void () { doTestSimpleInsertion("xyz", "a"); doTestSimpleInsertion(" xyz", "a"); doTestSimpleInsertion("x yz", "a"); doTestSimpleInsertion("xy z", "a"); doTestSimpleInsertion("xyz ", "a"); doTestSimpleInsertion(" xyz ", "a"); doTestSimpleInsertion(" x y z ", "a"); } | testSimpleTextInsertion |
300,372 | void () { doTestSimpleInsertion("xyz", " "); } | testWhitespaceTextInsertion |
300,373 | void () { doTestSimpleDeletion("xyz"); doTestSimpleDeletion(" xyz"); doTestSimpleDeletion("x yz"); doTestSimpleDeletion("xy z"); doTestSimpleDeletion("xyz "); doTestSimpleDeletion(" xyz "); doTestSimpleDeletion(" x y z "); } | testSimpleTextDeletion |
300,374 | void () { doTestSimpleDeletion(" xyz"); doTestSimpleDeletion("x yz"); doTestSimpleDeletion("xy z"); doTestSimpleDeletion("xyz "); doTestSimpleDeletion(" xyz "); doTestSimpleDeletion(" x y z "); } | testWhitespaceDeletion |
300,375 | void () { doTestEscapedInsertion("xyz", "&"); doTestEscapedInsertion("xyz", "&&"); doTestEscapedInsertion("xyz", "&x&"); doTestEscapedInsertion("&xyz", "a"); doTestEscapedInsertion("&xyz", " "); doTestEscapedInsertion("x&yz", "a"); doTestEscapedInsertion("x&yz", " "); doTestEscapedInsertion("xy&z", "a"); doTestEscapedInsertion("xy&z", " "); doTestEscapedInsertion("xyz&", "a"); doTestEscapedInsertion("xyz&", " "); doTestEscapedInsertion("&x&y&z&", "a"); doTestEscapedInsertion(" x&y&z&", "a"); doTestEscapedInsertion(" x y&z&", "a"); doTestEscapedInsertion("&x y&z&", "a"); doTestEscapedInsertion("&x y&z ", "a"); doTestEscapedInsertion("&x&y&z&", "<"); doTestEscapedInsertion("&x&y&z&", ">"); doTestEscapedInsertion("_xyz", "a"); doTestEscapedInsertion("x_yz", "a"); doTestEscapedInsertion("xy_z", "a"); doTestEscapedInsertion("xyz_", "a"); doTestEscapedInsertion("_xyz_", "a"); doTestEscapedInsertion("_x_y_z_", "a"); } | testEscapedInsertion |
300,376 | void () { doTestEscapedDeletion("&"); doTestEscapedDeletion("&&"); doTestEscapedDeletion(" &&"); doTestEscapedDeletion(" & &"); doTestEscapedDeletion(" & & "); doTestEscapedDeletion(" && "); doTestEscapedDeletion("&& "); doTestEscapedDeletion("& "); doTestEscapedDeletion(" "); doTestEscapedDeletion("&abc"); doTestEscapedDeletion("a&bc"); doTestEscapedDeletion("ab&c"); doTestEscapedDeletion("abc&"); doTestEscapedDeletion(" &abc"); doTestEscapedDeletion("a &bc"); doTestEscapedDeletion("ab &c"); doTestEscapedDeletion("abc &"); doTestEscapedDeletion("& abc"); doTestEscapedDeletion("a& bc"); doTestEscapedDeletion("ab& c"); doTestEscapedDeletion("abc& "); } | notestEscapedDeletion |
300,377 | void () { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a> <b/> </a>"); ApplicationManager.getApplication().runWriteAction(() -> tag.findFirstSubTag("b").delete()); assertEquals("<a> </a>", tag.getText()); } | testWhitespacesInEmptyXHTMLTag |
300,378 | void () { XmlFile file = (XmlFile)createFile("file.xml", "<a>x y</a>"); XmlTag tag = file.getDocument().getRootTag(); final XmlText xmlText = tag.getValue().getTextElements()[0]; ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { try { xmlText.insertText("z", 1); } catch (IncorrectOperationException e) { throw new RuntimeException(e); } }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); assertEquals("<a>xz y</a>", tag.getText()); } | test2 |
300,379 | String (String text) { text = text.replaceAll("<", "<"); text = text.replaceAll(">", ">"); text = text.replaceAll("&", "&"); text = text.replaceAll("'", "'"); text = text.replaceAll(""", "\""); text = text.replaceAll("<!\\[CDATA\\[", ""); text = text.replaceAll("\\]\\]>", ""); return text.replaceAll(" ", "_"); } | toDisplay |
300,380 | String (String original) { String text = original.replaceAll("<", "<"); text = text.replaceAll(">", ">"); text = text.replaceAll("&", "&"); text = text.replaceAll("'", "'"); text = text.replaceAll("\"", """); text = text.replaceAll("_", " "); assertEquals(original, toDisplay(text)); return text; } | toEscapedText |
300,381 | void () { doCoordinateMappingConsistentFromDisplayText("abc"); doCoordinateMappingConsistentFromDisplayText(" abc"); doCoordinateMappingConsistentFromDisplayText(" a bc"); doCoordinateMappingConsistentFromDisplayText(" a b c"); doCoordinateMappingConsistentFromDisplayText(" a b c "); doCoordinateMappingConsistentFromDisplayText(" ab c "); doCoordinateMappingConsistentFromDisplayText(" abc "); doCoordinateMappingConsistentFromDisplayText("abc "); doCoordinateMappingConsistentFromDisplayText(" "); doCoordinateMappingConsistentFromDisplayText("&"); doCoordinateMappingConsistentFromDisplayText("&abc"); doCoordinateMappingConsistentFromDisplayText(" &abc"); doCoordinateMappingConsistentFromDisplayText(" a& bc"); doCoordinateMappingConsistentFromDisplayText(" a &b c"); doCoordinateMappingConsistentFromDisplayText(" a b& c "); doCoordinateMappingConsistentFromDisplayText(" ab c& "); doCoordinateMappingConsistentFromDisplayText(" ab&c "); doCoordinateMappingConsistentFromDisplayText("abc &"); doCoordinateMappingConsistentFromDisplayText("abc&"); doCoordinateMappingConsistentFromDisplayText("ab&c&"); doCoordinateMappingConsistentFromDisplayText("ab&c"); doCoordinateMappingConsistentFromDisplayText("a&b&c"); doCoordinateMappingConsistentFromEscapedText("<![CDATA[ ]]>"); doCoordinateMappingConsistentFromEscapedText("<![CDATA[x]]>"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[x]]>"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[x]]>xxx"); doCoordinateMappingConsistentFromEscapedText("xxx&<![CDATA[x]]>xxx"); doCoordinateMappingConsistentFromEscapedText("xxx&<![CDATA[x]]>&xxx"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[x]]>&xxx"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[xas]]>&xxx"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[xa>s]]>&xxx"); doCoordinateMappingConsistentFromEscapedText("xxx<![CDATA[x<a>s]]>&xxx"); } | testCoordinateMappingConsistent |
300,382 | void () { final XmlTag tagA = XmlElementFactory.getInstance(getProject()).createXHTMLTagFromText("<a>1<b> </b></a>"); final XmlTag tagB = tagA.findFirstSubTag("b"); final XmlTagChild nbsp = tagB.getValue().getChildren()[0]; assertEquals(" ", nbsp.getText()); ApplicationManager.getApplication().runWriteAction(() -> { tagA.addBefore(nbsp.copy(), tagB); }); XmlTagChild nbsp1 = tagA.getValue().getChildren()[0]; assertEquals("1 ", nbsp1.getText()); } | testNBSP |
300,383 | void () { ApplicationManager.getApplication().runWriteAction(() -> XmlElementFactory.getInstance(getProject()).createTagFromText("<a/>").getValue().setText("@#$%@$%$${${''}")); } public void testPsiToDocumentSynchronizationFailed() throws Throwable { String text = "<wpd><methods> </methods></wpd>"; final File tempFile = FileUtil.createTempFile("idea-test", ".xml"); tempFile.createNewFile(); FileUtil.writeToFile(tempFile, text); ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance().executeCommand(getProject(), () -> { VirtualFileManager.getInstance().syncRefresh(); XmlFile file ;//createTemporaryFile("wpd.xml", text)); try { file = (XmlFile)getPsiManager().findFile(VfsUtil.findFileByURL(tempFile.toURL())); } catch (MalformedURLException e) { throw new RuntimeException(e); } final XmlTag methodTag = file.getDocument().getRootTag().findFirstSubTag("methods"); try { methodTag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("<method/>")); } catch (IncorrectOperationException e) { throw new RuntimeException(e); } }, "", null, UndoConfirmationPolicy.DO_NOT_REQUEST_CONFIRMATION)); } public void testXmlFormattingException() { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo>bar</foo>"); ApplicationManager.getApplication().runWriteAction(() -> { tag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("<bar/>")); }); } public void testSetNamespace() { XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", "<html><body/></html>"); final XmlTag rootTag = xhtmlFile.getDocument().getRootTag(); rootTag.getSubTags()[0].getNamespace(); // fill the cache ApplicationManager.getApplication().runWriteAction(() -> { rootTag.setAttribute("xmlns", "http://www.ru"); }); assertEquals("http://www.ru", rootTag.getSubTags()[0].getNamespace()); } public void testInsert() { String html = "<html><head /><body><hr /></body>\n</html>"; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("xxx.xhtml", html); XmlTag body = file.getDocument().getRootTag().findFirstSubTag("body"); final XmlTag hr = body.getSubTags()[0]; final XmlText text = XmlElementFactory.getInstance(getProject()).createDisplayText("p"); ApplicationManager.getApplication().runWriteAction(() -> { PsiElement element = hr.getParentTag().addAfter(text, hr); assertEquals(element.getParent(), hr.getParentTag()); }); } public void testCollapse() throws IncorrectOperationException { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo></foo>"); ApplicationManager.getApplication().runWriteAction(() -> { tag.collapseIfEmpty(); assertEquals("<foo/>", tag.getText()); final XmlTag tag1 = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo>abc</foo>"); tag1.collapseIfEmpty(); assertEquals("<foo/>", tag1.getText()); final XmlTag tag2 = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo><boo/></foo>"); tag2.collapseIfEmpty(); assertEquals("<foo><boo/></foo>", tag2.getText()); }); } public void testSetName() { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", XmlFileType.INSTANCE, "<fooBarGoo>1</fooBarGoo>", 0, true); final XmlTag tag = file.getDocument().getRootTag(); final Document document = file.getViewProvider().getDocument(); ApplicationManager.getApplication().runWriteAction(() -> { tag.setName("xxx"); assertEquals("<xxx>1</xxx>", tag.getText()); assertEquals("<xxx>1</xxx>", document.getText()); }); } public void testSetAttributeValue() { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", XmlFileType.INSTANCE, "<fooBarGoo attr>1</fooBarGoo>", 0, true); final XmlTag tag = file.getDocument().getRootTag(); final Document document = file.getViewProvider().getDocument(); ApplicationManager.getApplication().runWriteAction(() -> { tag.setAttribute("attr", ""); assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", tag.getText()); assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", document.getText()); }); } } | testStrangeCharactesInText |
300,384 | void () { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo>bar</foo>"); ApplicationManager.getApplication().runWriteAction(() -> { tag.add(XmlElementFactory.getInstance(getProject()).createTagFromText("<bar/>")); }); } | testXmlFormattingException |
300,385 | void () { XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", "<html><body/></html>"); final XmlTag rootTag = xhtmlFile.getDocument().getRootTag(); rootTag.getSubTags()[0].getNamespace(); // fill the cache ApplicationManager.getApplication().runWriteAction(() -> { rootTag.setAttribute("xmlns", "http://www.ru"); }); assertEquals("http://www.ru", rootTag.getSubTags()[0].getNamespace()); } | testSetNamespace |
300,386 | void () { String html = "<html><head /><body><hr /></body>\n</html>"; XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("xxx.xhtml", html); XmlTag body = file.getDocument().getRootTag().findFirstSubTag("body"); final XmlTag hr = body.getSubTags()[0]; final XmlText text = XmlElementFactory.getInstance(getProject()).createDisplayText("p"); ApplicationManager.getApplication().runWriteAction(() -> { PsiElement element = hr.getParentTag().addAfter(text, hr); assertEquals(element.getParent(), hr.getParentTag()); }); } | testInsert |
300,387 | void () { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", XmlFileType.INSTANCE, "<fooBarGoo>1</fooBarGoo>", 0, true); final XmlTag tag = file.getDocument().getRootTag(); final Document document = file.getViewProvider().getDocument(); ApplicationManager.getApplication().runWriteAction(() -> { tag.setName("xxx"); assertEquals("<xxx>1</xxx>", tag.getText()); assertEquals("<xxx>1</xxx>", document.getText()); }); } | testSetName |
300,388 | void () { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xml", XmlFileType.INSTANCE, "<fooBarGoo attr>1</fooBarGoo>", 0, true); final XmlTag tag = file.getDocument().getRootTag(); final Document document = file.getViewProvider().getDocument(); ApplicationManager.getApplication().runWriteAction(() -> { tag.setAttribute("attr", ""); assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", tag.getText()); assertEquals("<fooBarGoo attr=\"\">1</fooBarGoo>", document.getText()); }); } | testSetAttributeValue |
300,389 | void () { configure(); assertSubtagNames("before", "include1", "after"); } | testBasicXi |
300,390 | void () { configure(); assertSubtagNames("before", "foo", "bar", "after"); } | testXpointerXi1 |
300,391 | void () { myFixture.copyDirectoryToProject("xmlBase", "xmlBase"); myFixture.enableInspections(XmlPathReferenceInspection.class); myFixture.testHighlighting("xmlBase/XmlBase.xml"); } | testXmlBase |
300,392 | String () { return "/xml/tests/testData/" + BASE_PATH; } | getBasePath |
300,393 | void (String... expectedNames) { final XmlTag tag = ((XmlFile)myFixture.getFile()).getDocument().getRootTag(); final List<String> names = Arrays.stream(tag.getSubTags()).map(t -> t.getName()).toList(); TestCase.assertEquals("subtags are different", StringUtil.join(expectedNames, "\n"), StringUtil.join(names, "\n")); } | assertSubtagNames |
300,394 | void () { myFixture.configureByFiles(getName() + ".xml", "/include1.xml"); } | configure |
300,395 | void () { myFixture.configureByText("a.xml", """ <root xmlns:xi="http://www.w3.org/2001/XInclude"> <before/> <xi:include href="include1.xml" xpointer="xpointer(/include1/*)"/> <after/> </root> """); VirtualFile inc1 = myFixture.copyFileToProject("include1.xml"); assertSubtagNames("before", "foo", "bar", "after"); changeText(inc1, "<include1><a/></include1>"); assertSubtagNames("before", "a", "after"); } | testModifyingIncludedFile |
300,396 | void () { myFixture.configureByText("a.xml", """ <root xmlns:xi="http://www.w3.org/2001/XInclude"> <before/> <xi:include href="include1.xml" xpointer="xpointer(/include1/*)"/> <after/> </root> """); myFixture.addFileToProject("include1.xml", """ <include1 xmlns:xi="http://www.w3.org/2001/XInclude"> <foo attr1="val1"> <fooChild/> </foo> <bar/> <xi:include href="include2.xml"/> </include1> """); PsiFile inc2 = myFixture.addFileToProject("include2.xml", "<a/>"); assertSubtagNames("before", "foo", "bar", "a", "after"); changeText(inc2.getVirtualFile(), "<b/>"); assertSubtagNames("before", "foo", "bar", "b", "after"); } | testModifyingTransitivelyIncludedFile |
300,397 | void (final VirtualFile inc1, final String s) { WriteAction.run( () -> { FileDocumentManager.getInstance().getDocument(inc1).setText(s); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); } ); } | changeText |
300,398 | void (final CharSequence name, final CharSequence value, final int startoffset, final int endoffset) { flushText(); builder.append("ATT: name='").append(name).append("' value='").append(value).append("'\n"); } | attribute |
300,399 | void (final CharSequence localName, final String namespace, final int startoffset, final int endoffset) { flushText(); builder.append("ENDTAG: name='").append(localName).append("' namespace='").append(namespace).append("'\n"); } | endTag |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.