From 4cb25601ee39ddf260a322d752c95db6509fb212 Mon Sep 17 00:00:00 2001 From: michelou Date: Thu, 29 Jun 2006 11:24:24 +0000 Subject: [PATCH] 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 --- build.xml | 52 ------------- test/clitest | 6 +- test/files/cli/test1/Main.check.scalaint | 57 +++------------ test/files/cli/test2/Main.check.scala_api | 17 +++++ test/files/cli/test2/Main.check.scalaint | 57 +++------------ test/files/cli/test3/Main.check.scala_api | 21 ++++++ test/files/cli/test3/Main.check.scalaint | 57 +++------------ test/files/run/richs.check | 60 +++++++++++++++ test/files/run/richs.scala | 89 +++++++++++++++++++++++ 9 files changed, 220 insertions(+), 196 deletions(-) create mode 100644 test/files/cli/test2/Main.check.scala_api create mode 100644 test/files/cli/test3/Main.check.scala_api create mode 100644 test/files/run/richs.check create mode 100644 test/files/run/richs.scala diff --git a/build.xml b/build.xml index 23acc968c..bdca88eca 100644 --- a/build.xml +++ b/build.xml @@ -58,8 +58,6 @@ PROPERTIES - - @@ -487,18 +469,6 @@ BUILD QUICK-TEST LAYER version="${version.number}" copyright="${copyright.string}" javaFlags="-Xmx256M -Xms16M"/> - - - - @@ -634,18 +600,6 @@ TEST version="${version.number}" copyright="${copyright.string}" javaFlags="-Xmx256M -Xms16M"/> - - - - @@ -870,8 +820,6 @@ GENERATES A DISTRIBUTION - - diff --git a/test/clitest b/test/clitest index bf093089d..5ae1bf10d 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 78ea0a424..78ddab22d 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 -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 Specify where to find user class files - -sourcepath Specify where to find input source files - -bootclasspath Override location of bootstrap class files - -extdirs Override location of installed extensions - -d Specify where to place generated class files - -encoding Specify character encoding used by source files - -windowtitle Specify window title of generated HTML documentation - -documenttitle Specify document title of generated HTML documentation - -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: Skip - -check: Check the tree at start of - -print: Print out program after - -printer: Printer to use (text,html) - -printfile Specify file in which to print trees - -graph: Graph the program after - -browse: Browse the abstract syntax tree after - -stop: Stop after phase - -log: Log operations in - -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 Show class info - -Xshowobj Show object info - -Xshowicode Print the generated ICode - -Xgadt enable gadt for classes - -Xlinearizer: Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types +unknown option: '-cpp' +scala [ | -howtorun:how ]... [ ] + +'s are as for scalac; see scalac -help. +, if present, is an object or script file to run. +If no is present, run an interactive interpreter. +-howtorun allows explicitly specifying how to run : + 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 000000000..1df1a7fb3 --- /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 e9f2bc743..e01f2b77e 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 -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 Specify where to find user class files - -sourcepath Specify where to find input source files - -bootclasspath Override location of bootstrap class files - -extdirs Override location of installed extensions - -d Specify where to place generated class files - -encoding Specify character encoding used by source files - -windowtitle Specify window title of generated HTML documentation - -documenttitle Specify document title of generated HTML documentation - -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: Skip - -check: Check the tree at start of - -print: Print out program after - -printer: Printer to use (text,html) - -printfile Specify file in which to print trees - -graph: Graph the program after - -browse: Browse the abstract syntax tree after - -stop: Stop after phase - -log: Log operations in - -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 Show class info - -Xshowobj Show object info - -Xshowicode Print the generated ICode - -Xgadt enable gadt for classes - -Xlinearizer: Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types +unknown option: '-cpp' +scala [ | -howtorun:how ]... [ ] + +'s are as for scalac; see scalac -help. +, if present, is an object or script file to run. +If no is present, run an interactive interpreter. +-howtorun allows explicitly specifying how to run : + 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 000000000..e65cebac2 --- /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 ac14f5f31..7beaa665a 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 -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 Specify where to find user class files - -sourcepath Specify where to find input source files - -bootclasspath Override location of bootstrap class files - -extdirs Override location of installed extensions - -d Specify where to place generated class files - -encoding Specify character encoding used by source files - -windowtitle Specify window title of generated HTML documentation - -documenttitle Specify document title of generated HTML documentation - -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: Skip - -check: Check the tree at start of - -print: Print out program after - -printer: Printer to use (text,html) - -printfile Specify file in which to print trees - -graph: Graph the program after - -browse: Browse the abstract syntax tree after - -stop: Stop after phase - -log: Log operations in - -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 Show class info - -Xshowobj Show object info - -Xshowicode Print the generated ICode - -Xgadt enable gadt for classes - -Xlinearizer: Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types +unknown option: '-cpp' +scala [ | -howtorun:how ]... [ ] + +'s are as for scalac; see scalac -help. +, if present, is an object or script file to run. +If no is present, run an interactive interpreter. +-howtorun allows explicitly specifying how to run : + 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 000000000..3b2f46801 --- /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 000000000..526783318 --- /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 + } +}