<commit_before>package org.jetbrains.plugins.scala
package annotator

import org.jetbrains.plugins.scala.base.SimpleTestCase
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunctionDefinition
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.scala.extensions._
import lang.psi.api.ScalaFile

/**
 * Pavel.Fatin, 18.05.2010
 */

class FunctionAnnotatorTest extends SimpleTestCase {
  final val Header = "class A; class B\n"

  def testUnitEmpty() {
    assertMatches(messages("def f { }")) {
      case Nil =>
    }
  }

  def testUnitExpression() {
    assertMatches(messages("def f { new A }")) {
      case Nil =>
    }
  }

  def testUnitExpressionUnit() {
    assertMatches(messages("def f { () }")) {
      case Nil =>
    }
  }

  def testUnitReturn() {
    assertMatches(messages("def f { return }")) {
      case Nil =>
    }
  }

  def testUnitReturnType() {
    assertMatches(messages("def f { return new A }")) {
      case Warning("new A", RedundantReturnData()) :: Nil =>
    }
  }

  def testUnitReturnUnit() {
    assertMatches(messages("def f { return () }")) {
      case Warning("()", RedundantReturnData()) :: Nil =>
    }
  }

  def testAssignNull() {
    assertMatches(messages("def f = null")) {
      case Nil =>
    }
  }

  def testAssignEmpty() {
    assertMatches(messages("def f = { }")) {
      case Nil =>
    }
  }

  def testAssignExpression() {
    assertMatches(messages("def f = { new A }")) {
      case Nil =>
    }
  }

  def testAssignReturn() {
    assertMatches(messages("def f = { return }")) {
      case Error("return", NeedsResultType()) :: Nil =>
    }
  }

  def testAssignReturnExpression() {
    assertMatches(messages("def f = { return new A }")) {
      case Error("return", NeedsResultType()) :: Nil =>
    }
  }

  def testTypeNull() {
    assertMatches(messages("def f: A = null")) {
      case Nil =>
    }
  }

  def testAnyValNull() {
    assertMatches(messages("def f: AnyVal = null")) {
      case Error("null", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeEmpty() {
    assertMatches(messages("def f: A = { }")) {
      case Error("{ }", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeAbsolutelyEmpty() {
    assertMatches(messages("def f: A = {}")) {
      case Error("{}", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeExpression() {
    assertMatches(messages("def f: A = { new A }")) {
      case Nil =>
    }
  }

  def testTypeWrongExpression() {
    assertMatches(messages("def f: A = { new B }")) {
      case Error("new B", TypeMismatch()) :: Nil =>
    }
  }
<commit_msg>Fixed testdata<commit_after>package org.jetbrains.plugins.scala
package annotator

import org.jetbrains.plugins.scala.base.SimpleTestCase
import org.jetbrains.plugins.scala.lang.psi.api.statements.ScFunctionDefinition
import org.intellij.lang.annotations.Language
import org.jetbrains.plugins.scala.extensions._
import lang.psi.api.ScalaFile

/**
 * Pavel.Fatin, 18.05.2010
 */

class FunctionAnnotatorTest extends SimpleTestCase {
  final val Header = "class A; class B\n"

  def testUnitEmpty() {
    assertMatches(messages("def f { }")) {
      case Nil =>
    }
  }

  def testUnitExpression() {
    assertMatches(messages("def f { new A }")) {
      case Nil =>
    }
  }

  def testUnitExpressionUnit() {
    assertMatches(messages("def f { () }")) {
      case Nil =>
    }
  }

  def testUnitReturn() {
    assertMatches(messages("def f { return }")) {
      case Nil =>
    }
  }

  def testUnitReturnType() {
    assertMatches(messages("def f { return new A }")) {
      case Warning("new A", RedundantReturnData()) :: Nil =>
    }
  }

  def testUnitReturnUnit() {
    assertMatches(messages("def f { return () }")) {
      case Warning("()", RedundantReturnData()) :: Nil =>
    }
  }

  def testAssignNull() {
    assertMatches(messages("def f = null")) {
      case Nil =>
    }
  }

  def testAssignEmpty() {
    assertMatches(messages("def f = { }")) {
      case Nil =>
    }
  }

  def testAssignExpression() {
    assertMatches(messages("def f = { new A }")) {
      case Nil =>
    }
  }

  def testAssignReturn() {
    assertMatches(messages("def f = { return }")) {
      case Error("return", NeedsResultType()) :: Nil =>
    }
  }

  def testAssignReturnExpression() {
    assertMatches(messages("def f = { return new A }")) {
      case Error("return", NeedsResultType()) :: Nil =>
    }
  }

  def testTypeNull() {
    assertMatches(messages("def f: A = null")) {
      case Nil =>
    }
  }

  def testAnyValNull() {
    assertMatches(messages("def f: AnyVal = null")) {
      case Error("null", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeEmpty() {
    assertMatches(messages("def f: A = { }")) {
      case Error("}", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeAbsolutelyEmpty() {
    assertMatches(messages("def f: A = {}")) {
      case Error("}", TypeMismatch()) :: Nil =>
    }
  }

  def testTypeExpression() {
    assertMatches(messages("def f: A = { new A }")) {
      case Nil =>
    }
  }

  def testTypeWrongExpression() {
    assertMatches(messages("def f: A = { new B }")) {
      case Error("new B", TypeMismatch()) :: Nil =>
    }
  }

{'fraction_non_alphanumeric': 0.15850366370998842, 'fraction_numerical': 0.0030852294639413806, 'mean_word_length': 2.83370288248337, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '3317272', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1671, 'n_words': 347}