DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

测试Scala代码


on Windows

test.bat内容:

set JUnitPath=C:\Users\chad\.ivy2\cache\junit\junit\jars\junit-4.8.2.jar 
set ScalaLibraryPath=F:\Software\scala-2.9.1.final\lib\scala-library.jar 
scalac -cp %JUnitPath%;. SampleTest.scala 
rem java -cp %JUnitPath%;%ScalaLibraryPath%;. org.junit.runner.JUnitCore SampleTest

SampleTest.scala内容:

import java.util.ArrayList 
import org.junit.Test 
import org.junit.Assert._ 
class SampleTest { 
  @Test def listAdd() { 
    val list = new ArrayList[String] 
    list.add("Milk") 
    list add "Sugar" 
    assertEquals(2, list.size()) 
  } 
}

注:set表达式中,变量名、等号和值三者之间不能有空格,否则赋值失败。

on Linux



Published

Nov 29, 2011

Last Updated

Nov 29, 2011

Category

Tech

Tags

  • JUnit 10
  • Scala 20
  • TestNG 2

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor