Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 73 lines (65 sloc) 1.613 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
package scala.tools.eclipse.semantichighlighting.classifier

import SymbolTypes._
import org.junit._

class CaseClassTest extends AbstractSymbolClassifierTest {

  @Test
  def case_class() {
    checkSymbolClassification("""
case class CaseClass {
def method(other: CaseClass) = 42
}""", """
case class $CASECLS$ {
def method(other: $CASECLS$) = 42
}""",
      Map("CASECLS" -> CaseClass))
  }

  @Test
  def case_class_creation() {
    checkSymbolClassification("""
case class CaseClass(n: Int) {
CaseClass(42)
}""", """
case class $CASECLS$(n: Int) {
$CASECLS$(42)
}""",
      Map("CASECLS" -> CaseClass))
  }

  @Test
  def case_class_in_import() {
    checkSymbolClassification("""
package foo { case class CaseClass }
import foo.CaseClass
""", """
package foo { case class $CASECLS$ }
import foo.$CASECLS$
""",
      Map("CASECLS" -> CaseClass))
  }

  @Test
  def case_class_pattern_match() {
    checkSymbolClassification("""
object X {
val Some(x) = Some(42)
}""", """
object X {
val $CC$(x) = Some(42)
}""",
      Map("CC" -> CaseClass))
  }

  @Test
  @Ignore("Enable when ticket #1001171 is fixed")
  def infix_notation_for_extractors() {
    checkSymbolClassification("""
class X {
val a Foo b = Foo(1, 2)
}
case class Foo(a: Int, b: Int)
""", """
class X {
val a $C$ b = $C$(1, 2)
}
case class $C$(a: Int, b: Int)
""",
        Map("C" -> CaseClass))
  }

}
Something went wrong with that request. Please try again.