void (@NotNull String testDataDir, @NotNull PsiFile file, boolean checkAllPsiRoots, @NotNull String targetDataName, boolean skipSpaces, boolean printRanges, boolean allTreesInSingleFile) { FileViewProvider provider = file.getViewProvider(); Set<Language> languages = provider.getLanguages(); if (!checkAllPsiRoots || languages.size() == 1) { doCheckResult(testDataDir, targetDataName + ".txt", toParseTreeText(file, skipSpaces, printRanges).trim()); return; } if (allTreesInSingleFile) { String expectedName = targetDataName + ".txt"; StringBuilder sb = new StringBuilder(); List<Language> languagesList = new ArrayList<>(languages); ContainerUtil.sort(languagesList, Comparator.comparing(Language::getID)); for (Language language : languagesList) { sb.append("Subtree: ").append(language.getDisplayName()).append(" (").append(language.getID()).append(")").append("\n") .append(toParseTreeText(provider.getPsi(language), skipSpaces, printRanges).trim()) .append("\n").append(StringUtil.repeat("-", 80)).append("\n"); } doCheckResult(testDataDir, expectedName, sb.toString()); } else { for (Language language : languages) { PsiFile root = provider.getPsi(language); assertNotNull("FileViewProvider " + provider + " didn't return PSI root for language " + language.getID(), root); String expectedName = targetDataName + "." + language.getID() + ".txt"; doCheckResult(testDataDir, expectedName, toParseTreeText(root, skipSpaces, printRanges).trim()); } } }