<commit_before>/*
 * @author max
 */
package com.intellij.psi;

import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.psi.impl.compiled.ClsStubBuilder;
import com.intellij.psi.impl.java.stubs.PsiClassStub;
import com.intellij.psi.impl.java.stubs.impl.PsiClassStubImpl;
import com.intellij.testFramework.LightIdeaTestCase;

import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;

public class ClsBuilderTest extends LightIdeaTestCase {
  public void testSimple() throws Exception {
    doTest("java/util/List.class", "UtilList.txt");
  }

  public void testManyGenerics() throws Exception {
    doTest("java/util/Collections.class", "UtilCollections.txt");
  }

  public void testWithAnnotations() throws Exception {
    doTest("org/jetbrains/annotations/Nullable.class", "Nullable.txt");
  }

  private void doTest(final String classname, final String goldFile) throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream(classname);

    final byte[] bytes = FileUtil.adaptiveLoadBytes(stream);
    final PsiClassStub stub = ClsStubBuilder.build(bytes);
    final String butWas = ((PsiClassStubImpl)stub).printTree();
    final String expected = FileUtil.loadTextAndClose(new FileReader(PathManagerEx.getTestDataPath() + "/psi/cls/stubBuilder/" + goldFile));
    assertEquals(expected, butWas);
  }
}<commit_msg>fix tests (diff in line separators)<commit_after>/*
 * @author max
 */
package com.intellij.psi;

import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.impl.compiled.ClsStubBuilder;
import com.intellij.psi.impl.java.stubs.PsiClassStub;
import com.intellij.psi.impl.java.stubs.impl.PsiClassStubImpl;
import com.intellij.testFramework.LightIdeaTestCase;

import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;

public class ClsBuilderTest extends LightIdeaTestCase {
  public void testSimple() throws Exception {
    doTest("java/util/List.class", "UtilList.txt");
  }

  public void testManyGenerics() throws Exception {
    doTest("java/util/Collections.class", "UtilCollections.txt");
  }

  public void testWithAnnotations() throws Exception {
    doTest("org/jetbrains/annotations/Nullable.class", "Nullable.txt");
  }

  private void doTest(final String classname, final String goldFile) throws IOException {
    final InputStream stream = getClass().getClassLoader().getResourceAsStream(classname);

    final byte[] bytes = FileUtil.adaptiveLoadBytes(stream);
    final PsiClassStub stub = ClsStubBuilder.build(bytes);
    final String butWas = ((PsiClassStubImpl)stub).printTree();
    String expected = FileUtil.loadTextAndClose(new FileReader(PathManagerEx.getTestDataPath() + "/psi/cls/stubBuilder/" + goldFile));
    expected = StringUtil.convertLineSeparators(expected);
    assertEquals(expected, butWas);
  }
}
{'fraction_non_alphanumeric': 0.11463495209778658, 'fraction_numerical': 0.0, 'mean_word_length': 5.361344537815126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6340023', 'n_tokens_mistral': 927, 'n_tokens_neox': 923, 'n_words': 176}