summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-06-29 11:24:24 +0000
committermichelou <michelou@epfl.ch>2006-06-29 11:24:24 +0000
commit47e617d9624de8f36bb222398604f386d561d0aa (patch)
tree98cb4536037d189fd42d704092903a5f8f66e977
parent4006064a64dbcececb368449b54d3b4592df48f2 (diff)
downloadscala-47e617d9624de8f36bb222398604f386d561d0aa.tar.gz
scala-47e617d9624de8f36bb222398604f386d561d0aa.tar.bz2
scala-47e617d9624de8f36bb222398604f386d561d0aa.zip
updated cli test, added test for multiline strings
-rw-r--r--build.xml52
-rwxr-xr-xtest/clitest6
-rw-r--r--test/files/cli/test1/Main.check.scalaint57
-rw-r--r--test/files/cli/test2/Main.check.scala_api17
-rw-r--r--test/files/cli/test2/Main.check.scalaint57
-rw-r--r--test/files/cli/test3/Main.check.scala_api21
-rw-r--r--test/files/cli/test3/Main.check.scalaint57
-rw-r--r--test/files/run/richs.check60
-rw-r--r--test/files/run/richs.scala89
9 files changed, 220 insertions, 196 deletions
diff --git a/build.xml b/build.xml
index 23acc968c3..bdca88eca5 100644
--- a/build.xml
+++ b/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"/>
<!-- ===========================================================================
@@ -341,18 +339,6 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
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"
class="scala.tools.nsc.CompileClient"
@@ -367,10 +353,6 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
<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 -->
<touch file="${locker.dir}/complete" verbose="no"/>
@@ -488,18 +470,6 @@ BUILD QUICK-TEST LAYER
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"
class="scala.tools.nsc.CompileClient"
@@ -513,10 +483,6 @@ BUILD QUICK-TEST LAYER
<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>
@@ -635,18 +601,6 @@ TEST
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"
class="scala.tools.nsc.CompileClient"
@@ -660,10 +614,6 @@ TEST
<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">
diff --git a/test/clitest b/test/clitest
index bf093089dd..5ae1bf10db 100755
--- a/test/clitest
+++ b/test/clitest
@@ -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}`
diff --git a/test/files/cli/test1/Main.check.scalaint b/test/files/cli/test1/Main.check.scalaint
index 78ea0a424e..78ddab22d7 100644
--- a/test/files/cli/test1/Main.check.scalaint
+++ b/test/files/cli/test1/Main.check.scalaint
@@ -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.
diff --git a/test/files/cli/test2/Main.check.scala_api b/test/files/cli/test2/Main.check.scala_api
new file mode 100644
index 0000000000..1df1a7fb32
--- /dev/null
+++ b/test/files/cli/test2/Main.check.scala_api
@@ -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
diff --git a/test/files/cli/test2/Main.check.scalaint b/test/files/cli/test2/Main.check.scalaint
index e9f2bc743d..e01f2b77ee 100644
--- a/test/files/cli/test2/Main.check.scalaint
+++ b/test/files/cli/test2/Main.check.scalaint
@@ -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.
diff --git a/test/files/cli/test3/Main.check.scala_api b/test/files/cli/test3/Main.check.scala_api
new file mode 100644
index 0000000000..e65cebac24
--- /dev/null
+++ b/test/files/cli/test3/Main.check.scala_api
@@ -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
diff --git a/test/files/cli/test3/Main.check.scalaint b/test/files/cli/test3/Main.check.scalaint
index ac14f5f315..7beaa665ae 100644
--- a/test/files/cli/test3/Main.check.scalaint
+++ b/test/files/cli/test3/Main.check.scalaint
@@ -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.
diff --git a/test/files/run/richs.check b/test/files/run/richs.check
new file mode 100644
index 0000000000..3b2f468010
--- /dev/null
+++ b/test/files/run/richs.check
@@ -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
diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala
new file mode 100644
index 0000000000..526783318b
--- /dev/null
+++ b/test/files/run/richs.scala
@@ -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
+ }
+}