<commit_before>package org.jetbrains.plugins.scala.lang.overrideImplement;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.PsiTestCase;
import junit.framework.Test;
import org.jetbrains.plugins.scala.ScalaLoader;
import org.jetbrains.plugins.scala.lang.psi.impl.toplevel.synthetic.SyntheticClasses;
import org.jetbrains.plugins.scala.util.TestUtils;

import java.io.File;

/**
 * User: <NAME>
 * Date: 26.09.2008
 */
public class OverrideImplementTest extends PsiTestCase {
  private static String JDK_HOME = TestUtils.getMockJdk();
  public static String rootPath = TestUtils.getTestDataPath() + "/override/";
  private static final String CARET_MARKER = "<caret>";
  private static final String END_MARKER = "<end>";

  private String removeMarker(String text) {
    int index = text.indexOf(CARET_MARKER);
    return text.substring(0, index) + text.substring(index + CARET_MARKER.length());
  }

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myProject.getComponent(SyntheticClasses.class).registerClasses();
    ScalaLoader.loadScala();

    final ModifiableRootModel rootModel = ModuleRootManager.getInstance(getModule()).getModifiableModel();
    VirtualFile sdkRoot = LocalFileSystem.getInstance().findFileByPath(rootPath);
    assertNotNull(sdkRoot);
    ContentEntry contentEntry = rootModel.addContentEntry(sdkRoot);
    rootModel.setSdk(JavaSdk.getInstance().createJdk("java sdk", JDK_HOME, false));
    contentEntry.addSourceFolder(sdkRoot, false);

    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        rootModel.commit();
      }
    });
  }

  public void testOverridedTypeAlias() throws Exception {
    String name = "genericTestCases/overridedTypeAlias.scala";
    runTest(name);
  }

  public void testFoo() throws Exception {
    String name = "simpleTests/foo.scala";
    runTest(name);
  }

  public void testEmptyLinePos() throws Exception {
    String name = "simpleTests/emptyLinePos.scala";
    runTest(name);
  }

/*
  public void testEmptyUpper() throws Exception {
    String name = "simpleTests/emptyUpper.scala";
    runTest(name);
  }
*/

  public void testNewLineBetweenMethods() throws Exception {
    String name = "simpleTests/newLineBetweenMethods.scala";
    runTest(name);
  }

  public void testNewLineUpper() throws Exception {
    String name = "simpleTests/newLineUpper.scala";
    runTest(name);
  }

  public void testOverrideFunction() throws Exception {
    String name = "simpleTests/overrideFunction.scala";
    runTest(name);<commit_msg>Indent for OI tests<commit_after>package org.jetbrains.plugins.scala.lang.overrideImplement;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.PsiTestCase;
import com.intellij.psi.codeStyle.FileTypeIndentOptionsProvider;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import junit.framework.Test;
import org.jetbrains.plugins.scala.ScalaLoader;
import org.jetbrains.plugins.scala.ScalaFileType;
import org.jetbrains.plugins.scala.lang.psi.impl.toplevel.synthetic.SyntheticClasses;
import org.jetbrains.plugins.scala.lang.formatting.settings.ScalaIndentOptionsProvider;
import org.jetbrains.plugins.scala.util.TestUtils;

import java.io.File;

/**
 * User: <NAME>
 * Date: 26.09.2008
 */
public class OverrideImplementTest extends PsiTestCase {
  private static String JDK_HOME = TestUtils.getMockJdk();
  public static String rootPath = TestUtils.getTestDataPath() + "/override/";
  private static final String CARET_MARKER = "<caret>";
  private static final String END_MARKER = "<end>";

  private String removeMarker(String text) {
    int index = text.indexOf(CARET_MARKER);
    return text.substring(0, index) + text.substring(index + CARET_MARKER.length());
  }

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myProject.getComponent(SyntheticClasses.class).registerClasses();
    ScalaLoader.loadScala();

    CodeStyleSettingsManager.getSettings(myProject).getIndentOptions(ScalaFileType.SCALA_FILE_TYPE).INDENT_SIZE = 2;

    final ModifiableRootModel rootModel = ModuleRootManager.getInstance(getModule()).getModifiableModel();
    VirtualFile sdkRoot = LocalFileSystem.getInstance().findFileByPath(rootPath);
    assertNotNull(sdkRoot);
    ContentEntry contentEntry = rootModel.addContentEntry(sdkRoot);
    rootModel.setSdk(JavaSdk.getInstance().createJdk("java sdk", JDK_HOME, false));
    contentEntry.addSourceFolder(sdkRoot, false);

    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        rootModel.commit();
      }
    });
  }

  public void testOverridedTypeAlias() throws Exception {
    String name = "genericTestCases/overridedTypeAlias.scala";
    runTest(name);
  }

  public void testFoo() throws Exception {
    String name = "simpleTests/foo.scala";
    runTest(name);
  }

  public void testEmptyLinePos() throws Exception {
    String name = "simpleTests/emptyLinePos.scala";
    runTest(name);
  }

  public void testNewLineBetweenMethods() throws Exception {
    String name = "simpleTests/newLineBetweenMethods.scala";
    runTest(name);
  }

  public void testNewLineUpper() throws Exception {
    String name = "simpleTests/newLineUpper.scala";
    runTest(name);
  }

  public void testOverrideFunction() throws Exception {
    String name = "simpleTests/overrideFunction.scala";
    runTest(name);
{'fraction_non_alphanumeric': 0.10712577714012435, 'fraction_numerical': 0.003028853817949944, 'mean_word_length': 4.998087954110899, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3232149', 'n_tokens_mistral': 1964, 'n_tokens_neox': 1869, 'n_words': 345}