updated cli test, added test for multiline strings
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@8032 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
84bc1b7e66
commit
4cb25601ee
52
build.xml
52
build.xml
|
@ -58,8 +58,6 @@ PROPERTIES
|
|||
<property name="scala.exec.name" value="scala"/>
|
||||
<property name="scalac.exec.name" value="scalac"/>
|
||||
<property name="scaladoc.exec.name" value="scaladoc"/>
|
||||
<property name="scalaint.exec.name" value="scalaint"/>
|
||||
<property name="scalascript.exec.name" value="scalascript"/>
|
||||
<property name="fsc.exec.name" value="fsc"/>
|
||||
|
||||
<!-- ===========================================================================
|
||||
|
@ -340,18 +338,6 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
|
|||
version="${version.number}"
|
||||
copyright="${copyright.string}"
|
||||
javaFlags="-Xmx256M -Xms16M"/>
|
||||
<lockertool
|
||||
file="${locker.dir}/bin/${scalaint.exec.name}"
|
||||
name="Scala interpreter"
|
||||
class="scala.tools.nsc.MainInterpreter"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<lockertool
|
||||
file="${locker.dir}/bin/${scalascript.exec.name}"
|
||||
name="Scala scripting tool"
|
||||
class="scala.tools.nsc.MainScript"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<lockertool
|
||||
file="${locker.dir}/bin/${fsc.exec.name}"
|
||||
name="Fast Scala compiler"
|
||||
|
@ -366,10 +352,6 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
|
|||
file="${locker.dir}/bin/${scala.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${locker.dir}/bin/${scaladoc.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${locker.dir}/bin/${scalaint.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${locker.dir}/bin/${scalascript.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${locker.dir}/bin/${fsc.exec.name}"/>
|
||||
<!-- Mark LOCKER as being completely built -->
|
||||
|
@ -487,18 +469,6 @@ BUILD QUICK-TEST LAYER
|
|||
version="${version.number}"
|
||||
copyright="${copyright.string}"
|
||||
javaFlags="-Xmx256M -Xms16M"/>
|
||||
<quicktool
|
||||
file="${quick.dir}/bin/${scalaint.exec.name}"
|
||||
name="Scala interpreter"
|
||||
class="scala.tools.nsc.MainInterpreter"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<quicktool
|
||||
file="${quick.dir}/bin/${scalascript.exec.name}"
|
||||
name="Scala scripting tool"
|
||||
class="scala.tools.nsc.MainScript"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<quicktool
|
||||
file="${quick.dir}/bin/${fsc.exec.name}"
|
||||
name="Fast Scala compiler"
|
||||
|
@ -512,10 +482,6 @@ BUILD QUICK-TEST LAYER
|
|||
file="${quick.dir}/bin/${scala.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${quick.dir}/bin/${scaladoc.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${quick.dir}/bin/${scalaint.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${quick.dir}/bin/${scalascript.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${quick.dir}/bin/${fsc.exec.name}"/>
|
||||
</target>
|
||||
|
@ -634,18 +600,6 @@ TEST
|
|||
version="${version.number}"
|
||||
copyright="${copyright.string}"
|
||||
javaFlags="-Xmx256M -Xms16M"/>
|
||||
<straptool
|
||||
file="${strap.dir}/bin/${scalaint.exec.name}"
|
||||
name="Scala interpreter"
|
||||
class="scala.tools.nsc.MainInterpreter"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<straptool
|
||||
file="${strap.dir}/bin/${scalascript.exec.name}"
|
||||
name="Scala scripting tool"
|
||||
class="scala.tools.nsc.MainScript"
|
||||
version="${version.number}"
|
||||
copyright="${copyright.string}"/>
|
||||
<straptool
|
||||
file="${strap.dir}/bin/${fsc.exec.name}"
|
||||
name="Fast Scala compiler"
|
||||
|
@ -659,10 +613,6 @@ TEST
|
|||
file="${strap.dir}/bin/${scala.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${strap.dir}/bin/${scaladoc.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${strap.dir}/bin/${scalaint.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${strap.dir}/bin/${scalascript.exec.name}"/>
|
||||
<chmod perm="ugo+rx"
|
||||
file="${strap.dir}/bin/${fsc.exec.name}"/>
|
||||
</target>
|
||||
|
@ -870,8 +820,6 @@ GENERATES A DISTRIBUTION
|
|||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scalac.exec.name}"/>
|
||||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scala.exec.name}"/>
|
||||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scaladoc.exec.name}"/>
|
||||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scalaint.exec.name}"/>
|
||||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scalascript.exec.name}"/>
|
||||
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${fsc.exec.name}"/>
|
||||
<!-- Copy the API, examples and man -->
|
||||
<copy todir="${dist.current.dir}/doc/scala">
|
||||
|
|
|
@ -379,9 +379,9 @@ while [ $# -gt 0 ]; do
|
|||
done;
|
||||
|
||||
if [ "$LANG" = "scala" ]; then
|
||||
RUNTIME_COMMAND="${BIN_DIR}scala"
|
||||
COMPILER_COMMAND="${BIN_DIR}$COMPILER"
|
||||
INTERPRETER_COMMAND="${BIN_DIR}scalaint"
|
||||
RUNTIME_COMMAND="${BIN_DIR}scala";
|
||||
COMPILER_COMMAND="${BIN_DIR}$COMPILER";
|
||||
INTERPRETER_COMMAND="${BIN_DIR}scala";
|
||||
DOCGEN_COMMAND="${BIN_DIR}scaladoc";
|
||||
elif [ "$LANG" = "java" ]; then
|
||||
RUNTIME_COMMAND=`which ${JAVACMD:=java}`
|
||||
|
|
|
@ -1,50 +1,13 @@
|
|||
scalaint: unknown option: '-cpp'
|
||||
Usage: scalaint <options | source files>
|
||||
where possible options include:
|
||||
-doc Generate documentation
|
||||
-g Generate debugging info
|
||||
-nowarn Generate no warnings
|
||||
-noassert Generate no assertions and assumptions
|
||||
-verbose Output messages about what the compiler is doing
|
||||
-classpath <path> Specify where to find user class files
|
||||
-sourcepath <path> Specify where to find input source files
|
||||
-bootclasspath <path> Override location of bootstrap class files
|
||||
-extdirs <dirs> Override location of installed extensions
|
||||
-d <directory> Specify where to place generated class files
|
||||
-encoding <encoding> Specify character encoding used by source files
|
||||
-windowtitle <windowtitle> Specify window title of generated HTML documentation
|
||||
-documenttitle <documenttitle> Specify document title of generated HTML documentation
|
||||
-target:<target> Specify which backend to use (jvm-1.5,jvm-1.4,msil,cldc)
|
||||
-migrate Assist in migrating from Scala version 1.0
|
||||
-debug Output debugging messages
|
||||
-statistics Print compiler statistics
|
||||
-explaintypes Explain type errors in more detail
|
||||
-resident Compiler stays resident, files to compile are read from standard input
|
||||
-uniqid Print identifiers with unique names (debugging option)
|
||||
-printtypes Print tree types (debugging option)
|
||||
-prompt Display a prompt after each error (debugging option)
|
||||
-noimports Compile without any implicit imports
|
||||
-nopredefs Compile without any implicit predefined values
|
||||
-skip:<phase> Skip <phase>
|
||||
-check:<phase> Check the tree at start of <phase>
|
||||
-print:<phase> Print out program after <phase>
|
||||
-printer:<printer> Printer to use (text,html)
|
||||
-printfile <file> Specify file in which to print trees
|
||||
-graph:<phase> Graph the program after <phase>
|
||||
-browse:<phase> Browse the abstract syntax tree after <phase>
|
||||
-stop:<phase> Stop after phase <phase>
|
||||
-log:<phase> Log operations in <phase>
|
||||
-version Print product version and exit
|
||||
-help Print a synopsis of standard options
|
||||
-Xinline Perform inlining when possible
|
||||
-Xcloselim Perform closure elimination
|
||||
-Xdce Perform dead code elimination
|
||||
-Xshowcls <class> Show class info
|
||||
-Xshowobj <object> Show object info
|
||||
-Xshowicode Print the generated ICode
|
||||
-Xgadt enable gadt for classes
|
||||
-Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump)
|
||||
-Xgenerics Use generic Java types
|
||||
unknown option: '-cpp'
|
||||
scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>]
|
||||
|
||||
<compiler-option>'s are as for scalac; see scalac -help.
|
||||
<torun>, if present, is an object or script file to run.
|
||||
If no <torun> is present, run an interactive interpreter.
|
||||
-howtorun allows explicitly specifying how to run <torun>:
|
||||
script: it is a script file
|
||||
object: it is an object name
|
||||
guess: (the default) try to guess
|
||||
|
||||
|
||||
This is an interpreter for Scala.
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|-- all-classes.html
|
||||
|-- index.html
|
||||
|-- modules.html
|
||||
|-- root-content.html
|
||||
|-- script.js
|
||||
|-- style.css
|
||||
|-- test1
|
||||
| `-- Main$object.html
|
||||
|-- test1$content.html
|
||||
|-- test1$package.html
|
||||
|-- test2
|
||||
| `-- Main$object.html
|
||||
|-- test2$content.html
|
||||
`-- test2$package.html
|
||||
|
||||
|
||||
2 directories, 12 files
|
|
@ -1,50 +1,13 @@
|
|||
scalaint: unknown option: '-cpp'
|
||||
Usage: scalaint <options | source files>
|
||||
where possible options include:
|
||||
-doc Generate documentation
|
||||
-g Generate debugging info
|
||||
-nowarn Generate no warnings
|
||||
-noassert Generate no assertions and assumptions
|
||||
-verbose Output messages about what the compiler is doing
|
||||
-classpath <path> Specify where to find user class files
|
||||
-sourcepath <path> Specify where to find input source files
|
||||
-bootclasspath <path> Override location of bootstrap class files
|
||||
-extdirs <dirs> Override location of installed extensions
|
||||
-d <directory> Specify where to place generated class files
|
||||
-encoding <encoding> Specify character encoding used by source files
|
||||
-windowtitle <windowtitle> Specify window title of generated HTML documentation
|
||||
-documenttitle <documenttitle> Specify document title of generated HTML documentation
|
||||
-target:<target> Specify which backend to use (jvm-1.5,jvm-1.4,msil,cldc)
|
||||
-migrate Assist in migrating from Scala version 1.0
|
||||
-debug Output debugging messages
|
||||
-statistics Print compiler statistics
|
||||
-explaintypes Explain type errors in more detail
|
||||
-resident Compiler stays resident, files to compile are read from standard input
|
||||
-uniqid Print identifiers with unique names (debugging option)
|
||||
-printtypes Print tree types (debugging option)
|
||||
-prompt Display a prompt after each error (debugging option)
|
||||
-noimports Compile without any implicit imports
|
||||
-nopredefs Compile without any implicit predefined values
|
||||
-skip:<phase> Skip <phase>
|
||||
-check:<phase> Check the tree at start of <phase>
|
||||
-print:<phase> Print out program after <phase>
|
||||
-printer:<printer> Printer to use (text,html)
|
||||
-printfile <file> Specify file in which to print trees
|
||||
-graph:<phase> Graph the program after <phase>
|
||||
-browse:<phase> Browse the abstract syntax tree after <phase>
|
||||
-stop:<phase> Stop after phase <phase>
|
||||
-log:<phase> Log operations in <phase>
|
||||
-version Print product version and exit
|
||||
-help Print a synopsis of standard options
|
||||
-Xinline Perform inlining when possible
|
||||
-Xcloselim Perform closure elimination
|
||||
-Xdce Perform dead code elimination
|
||||
-Xshowcls <class> Show class info
|
||||
-Xshowobj <object> Show object info
|
||||
-Xshowicode Print the generated ICode
|
||||
-Xgadt enable gadt for classes
|
||||
-Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump)
|
||||
-Xgenerics Use generic Java types
|
||||
unknown option: '-cpp'
|
||||
scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>]
|
||||
|
||||
<compiler-option>'s are as for scalac; see scalac -help.
|
||||
<torun>, if present, is an object or script file to run.
|
||||
If no <torun> is present, run an interactive interpreter.
|
||||
-howtorun allows explicitly specifying how to run <torun>:
|
||||
script: it is a script file
|
||||
object: it is an object name
|
||||
guess: (the default) try to guess
|
||||
|
||||
|
||||
This is an interpreter for Scala.
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
|-- all-classes.html
|
||||
|-- index.html
|
||||
|-- modules.html
|
||||
|-- root-content.html
|
||||
|-- script.js
|
||||
|-- style.css
|
||||
|-- test1
|
||||
| `-- Main$object.html
|
||||
|-- test1$content.html
|
||||
|-- test1$package.html
|
||||
|-- test2
|
||||
| `-- Main$object.html
|
||||
|-- test2$content.html
|
||||
|-- test2$package.html
|
||||
|-- test3
|
||||
| `-- Main$object.html
|
||||
|-- test3$content.html
|
||||
`-- test3$package.html
|
||||
|
||||
|
||||
3 directories, 15 files
|
|
@ -1,50 +1,13 @@
|
|||
scalaint: unknown option: '-cpp'
|
||||
Usage: scalaint <options | source files>
|
||||
where possible options include:
|
||||
-doc Generate documentation
|
||||
-g Generate debugging info
|
||||
-nowarn Generate no warnings
|
||||
-noassert Generate no assertions and assumptions
|
||||
-verbose Output messages about what the compiler is doing
|
||||
-classpath <path> Specify where to find user class files
|
||||
-sourcepath <path> Specify where to find input source files
|
||||
-bootclasspath <path> Override location of bootstrap class files
|
||||
-extdirs <dirs> Override location of installed extensions
|
||||
-d <directory> Specify where to place generated class files
|
||||
-encoding <encoding> Specify character encoding used by source files
|
||||
-windowtitle <windowtitle> Specify window title of generated HTML documentation
|
||||
-documenttitle <documenttitle> Specify document title of generated HTML documentation
|
||||
-target:<target> Specify which backend to use (jvm-1.5,jvm-1.4,msil,cldc)
|
||||
-migrate Assist in migrating from Scala version 1.0
|
||||
-debug Output debugging messages
|
||||
-statistics Print compiler statistics
|
||||
-explaintypes Explain type errors in more detail
|
||||
-resident Compiler stays resident, files to compile are read from standard input
|
||||
-uniqid Print identifiers with unique names (debugging option)
|
||||
-printtypes Print tree types (debugging option)
|
||||
-prompt Display a prompt after each error (debugging option)
|
||||
-noimports Compile without any implicit imports
|
||||
-nopredefs Compile without any implicit predefined values
|
||||
-skip:<phase> Skip <phase>
|
||||
-check:<phase> Check the tree at start of <phase>
|
||||
-print:<phase> Print out program after <phase>
|
||||
-printer:<printer> Printer to use (text,html)
|
||||
-printfile <file> Specify file in which to print trees
|
||||
-graph:<phase> Graph the program after <phase>
|
||||
-browse:<phase> Browse the abstract syntax tree after <phase>
|
||||
-stop:<phase> Stop after phase <phase>
|
||||
-log:<phase> Log operations in <phase>
|
||||
-version Print product version and exit
|
||||
-help Print a synopsis of standard options
|
||||
-Xinline Perform inlining when possible
|
||||
-Xcloselim Perform closure elimination
|
||||
-Xdce Perform dead code elimination
|
||||
-Xshowcls <class> Show class info
|
||||
-Xshowobj <object> Show object info
|
||||
-Xshowicode Print the generated ICode
|
||||
-Xgadt enable gadt for classes
|
||||
-Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump)
|
||||
-Xgenerics Use generic Java types
|
||||
unknown option: '-cpp'
|
||||
scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>]
|
||||
|
||||
<compiler-option>'s are as for scalac; see scalac -help.
|
||||
<torun>, if present, is an object or script file to run.
|
||||
If no <torun> is present, run an interactive interpreter.
|
||||
-howtorun allows explicitly specifying how to run <torun>:
|
||||
script: it is a script file
|
||||
object: it is an object name
|
||||
guess: (the default) try to guess
|
||||
|
||||
|
||||
This is an interpreter for Scala.
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
RichIntTest:
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
0
|
||||
0
|
||||
|
||||
RichStringTest1:
|
||||
s1: abc
|
||||
s2: abc\txyz\n
|
||||
s3: abc
|
||||
xyz
|
||||
s4: abc
|
||||
|xyz
|
||||
s5: abc
|
||||
#xyz
|
||||
|
||||
RichStringTest2:
|
||||
s1: abc
|
||||
s2: abc\txyz\n
|
||||
s3: abc
|
||||
xyz
|
||||
s4: abc
|
||||
|xyz
|
||||
s5: abc
|
||||
#xyz
|
||||
|
||||
RichStringTest3:
|
||||
s1: abc
|
||||
s2: abc\txyz\n
|
||||
s3: abc
|
||||
xyz
|
||||
s4: abc
|
||||
|xyz
|
||||
s5: abc
|
||||
#xyz
|
||||
|
||||
RichStringTest4:
|
||||
s1: abc
|
||||
s2: abc\txyz\n
|
||||
s3: abc
|
||||
xyz
|
||||
s4: abc
|
||||
xyz
|
||||
s5: abc
|
||||
#xyz
|
||||
|
||||
RichStringTest5:
|
||||
s1: abc
|
||||
xyz
|
||||
s2: abc
|
||||
xyz
|
||||
s3: abc
|
||||
xyz
|
||||
s4: abc
|
||||
|xyz
|
||||
s5: abc
|
||||
xyz
|
|
@ -0,0 +1,89 @@
|
|||
trait RichTest {
|
||||
val s1 = """abc"""
|
||||
val s2 = """abc\txyz\n"""
|
||||
val s3 = """abc
|
||||
xyz"""
|
||||
val s4 = """abc
|
||||
|xyz"""
|
||||
val s5 = """abc
|
||||
#xyz"""
|
||||
def getObjectName: String = {
|
||||
val cn = this.getClass().getName()
|
||||
cn.substring(0, cn.length-1)
|
||||
}
|
||||
def length[A](it: Iterator[A]) = it.toList length
|
||||
def run: Unit
|
||||
}
|
||||
object RichIntTest extends RichTest {
|
||||
private val n = 10
|
||||
private val m = -2
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.println(length(0 until n))
|
||||
Console.println(length(0 to n))
|
||||
Console.println(length(m until n))
|
||||
Console.println(length(m to n))
|
||||
Console.println(length(n until m))
|
||||
Console.println(length(n to m))
|
||||
}
|
||||
}
|
||||
object RichStringTest1 extends RichTest {
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.println("s1: " + s1)
|
||||
Console.println("s2: " + s2)
|
||||
Console.println("s3: " + s3)
|
||||
Console.println("s4: " + s4)
|
||||
Console.println("s5: " + s5)
|
||||
}
|
||||
}
|
||||
object RichStringTest2 extends RichTest {
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.print("s1: "); s1.lines foreach Console.println
|
||||
Console.print("s2: "); s2.lines foreach Console.println
|
||||
Console.print("s3: "); s3.lines foreach Console.println
|
||||
Console.print("s4: "); s4.lines foreach Console.println
|
||||
Console.print("s5: "); s5.lines foreach Console.println
|
||||
}
|
||||
}
|
||||
object RichStringTest3 extends RichTest {
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.println("s1: " + s1.stripLineEnd)
|
||||
Console.println("s2: " + s2.stripLineEnd)
|
||||
Console.println("s3: " + s3.stripLineEnd)
|
||||
Console.println("s4: " + s4.stripLineEnd)
|
||||
Console.println("s5: " + s5.stripLineEnd)
|
||||
}
|
||||
}
|
||||
object RichStringTest4 extends RichTest {
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.println("s1: " + s1.stripMargin)
|
||||
Console.println("s2: " + s2.stripMargin)
|
||||
Console.println("s3: " + s3.stripMargin)
|
||||
Console.println("s4: " + s4.stripMargin)
|
||||
Console.println("s5: " + s5.stripMargin)
|
||||
}
|
||||
}
|
||||
object RichStringTest5 extends RichTest {
|
||||
def run: Unit = {
|
||||
Console.println("\n" + getObjectName + ":")
|
||||
Console.println("s1: " + s3.stripMargin('#'))
|
||||
Console.println("s2: " + s3.stripMargin('#'))
|
||||
Console.println("s3: " + s3.stripMargin('#'))
|
||||
Console.println("s4: " + s4.stripMargin('#'))
|
||||
Console.println("s5: " + s5.stripMargin('#'))
|
||||
}
|
||||
}
|
||||
object Test {
|
||||
def main(args: Array[String]): Unit = {
|
||||
RichIntTest.run
|
||||
RichStringTest1.run
|
||||
RichStringTest2.run
|
||||
RichStringTest3.run
|
||||
RichStringTest4.run
|
||||
RichStringTest5.run
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue