diff options
author | michelou <michelou@epfl.ch> | 2006-03-31 17:30:26 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-03-31 17:30:26 +0000 |
commit | 315ba402be1881e1c5ec812ffb14aa42c254e167 (patch) | |
tree | 13bf02be6ced91596bfcb37e320b3806a9611e72 | |
parent | b178e4658b3066b3f2cb2210bc57af9e8de71868 (diff) | |
download | scala-315ba402be1881e1c5ec812ffb14aa42c254e167.tar.gz scala-315ba402be1881e1c5ec812ffb14aa42c254e167.tar.bz2 scala-315ba402be1881e1c5ec812ffb14aa42c254e167.zip |
added more functionality to test/clitest
corrected bug in file scala/concurrent/pilib.scala
23 files changed, 832 insertions, 188 deletions
diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala index 9d8611383d..19cc8f836e 100644 --- a/src/library/scala/concurrent/pilib.scala +++ b/src/library/scala/concurrent/pilib.scala @@ -9,7 +9,7 @@ // $Id$ -package scala.concurrent; +package scala.concurrent /** @@ -181,11 +181,9 @@ object pilib { /** Pi-calculus non-deterministic choice. */ def choice[a](s: GP[a]*): a = { - val sum = Sum(s.asInstanceOf[List[GP[a]]] map { x => x.untyped }); + val sum = Sum(s.toList map { x => x.untyped }); synchronized { sums = compare(sum, sums) }; (sum.continue).asInstanceOf[a] } - } - diff --git a/test/clitest b/test/clitest index 38521d5fdf..c6c08c6119 100755 --- a/test/clitest +++ b/test/clitest @@ -83,7 +83,10 @@ test_print_help() { [ $# = 0 ] || abort "internal error"; test_print_usage; echo ""; + echo "--debug redirect all outputs to standard output"; echo "--info display information messages"; + echo "--java run same tests for Java"; + echo "--objdir=<dir> specify where to place generated files"; echo "--verbose display verbose messages"; echo "--help, -? display this help and exit"; echo "--version output version information and exit"; @@ -92,7 +95,137 @@ test_print_help() { # Prints the clitest version. test_print_version() { [ $# = 0 ] || abort "internal error"; - echo "$SCRIPT 1.0"; + echo "$SCRIPT 1.1"; +} + +test_run() { + [ $# = 1 ] || abort "internal error"; + cmd="$1"; shift 1; + [ "$DEBUG" = "debug" ] && ( printf_outline "[DEBUG]"; echo "$cmd"); + eval "$cmd"; +} + +test_diff() { + [ $# = 2 ] || abort "internal error"; + check="$1"; shift 1; + log="$1"; shift 1; + [ "$DEBUG" = "debug" ] && return; + sed -e "s#$TEST_DIR/##g" $log > $TMP_FILE; + $DIFF $check $TMP_FILE > $DIFF_FILE + if [ -n "`cat $DIFF_FILE`" ] ; then + printf_outline "\\nDifferences between check and log files:\\n"; + cat $DIFF_FILE; + fi +} + +test_compile() { + [ $# = 3 ] || abort "internal error"; + source="$1"; shift 1; + check="$1"; shift 1; + info="$1"; shift 1; + [ -d "$OUTPUT_DIR" ] || mkdir -p $OUTPUT_DIR; + [ -f "$LOG_FILE" ] && rm $LOG_FILE; + + if [ "$LANG" = "java" ] ; then + suffix=".javac" + elif [ "$LANG" = "java5" ] ; then + suffix=".javac5"; + else + suffix=".scalac" + fi + + file=`echo $source | sed -e "s#$PREFIX/##g"`; + if [ "$LEVEL" = "info" ] || [ "$LEVEL" = "verbose" ] ; then + printf_outline "\\nSource file: $file\\n" + cat $source; + fi + printf "\\n"; + + printf "Compile $file ($info) with unknown option '-dd'\\n" + test_run "env CLASSPATH= $SCALAC -dd $OUTPUT_DIR $source 2>> $LOG_FILE"; + + printf "Compile $file ($info) with no classpath information\\n" + test_run "env CLASSPATH= $SCALAC -d $OUTPUT_DIR $source 2>> $LOG_FILE"; + + printf "Compile $file ($info) with variable CLASSPATH\\n" + test_run "env CLASSPATH=$OUTPUT_DIR $SCALAC \ + -d $OUTPUT_DIR $source 2>> $LOG_FILE"; + + printf "Compile $file ($info) with option -classpath\\n" + test_run "env CLASSPATH= $SCALAC -classpath $OUTPUT_DIR \ + -d $OUTPUT_DIR $source 2>> $LOG_FILE"; + + printf "Compile $file ($info) with current directory as default classpath\\n" + test_run "(cd $OUTPUT_DIR && + env CLASSPATH= $SCALAC $source 2>> $LOG_FILE)"; + + test_diff "$check$suffix" "$LOG_FILE"; + + if [ "$LEVEL" = "verbose" ] ; then + printf_outline "\\nTest directory:\\n" + tree $TMP_DIR + fi +} + +test_execute() { + [ $# = 2 ] || abort "internal error"; + main="$1"; shift 1; + check="$1"; shift 1; + [ -f "$LOG_FILE" ] && rm $LOG_FILE; + printf "\\n"; + + printf "Execute $main with unknown option '-cpp'\\n" + test_run "env CLASSPATH= $SCALA -cpp $OUTPUT_DIR $main 2 \ + 2>> $LOG_FILE 1>> $LOG_FILE"; + + printf "Execute $main with variable CLASSPATH\\n" + test_run "env CLASSPATH=$OUTPUT_DIR $SCALA $main 1 \ + 2>> $LOG_FILE 1>> $LOG_FILE"; + + printf "Execute $main with option -classpath\\n" + test_run "env CLASSPATH= $SCALA -cp $OUTPUT_DIR $main 2 \ + 2>> $LOG_FILE 1>> $LOG_FILE"; + + printf "Execute $main with current directory as default classpath\\n" + test_run "(cd $OUTPUT_DIR && + env CLASSPATH= $SCALA $main 3 2>> $LOG_FILE 1>> $LOG_FILE)"; + + test_diff "$check.scala" "$LOG_FILE"; +} + +test_interpret() { + [ $# = 2 ] || abort "internal error"; + main="$1"; shift 1; + check="$1"; shift 1; + ([ "$LANG" = "java" ] || [ "$LANG" = "java5" ]) && return; + [ -f "$LOG_FILE" ] && rm $LOG_FILE; + printf "\\n" + + printf "Interpret $main with unknown option '-cpp'\\n" + test_run "(env CLASSPATH= \ + printf $main'.main(Array(\"0\"))\n:q' | $SCALAINT \ + -cpp $OUTPUT_DIR 2>> $LOG_FILE 1>> $LOG_FILE)"; + printf "\\n" >> $LOG_FILE # newline + + printf "Interpret $main with variable CLASSPATH\\n" + test_run "(env CLASSPATH=$OUTPUT_DIR \ + printf $main'.main(Array(\"1\"))\n:q' | $SCALAINT \ + 2>> $LOG_FILE 1>> $LOG_FILE)"; + printf "\\n" >> $LOG_FILE # newline + + printf "Interpret $main with option -classpath\\n" + test_run "(env CLASSPATH= \ + printf $main'.main(Array(\"2\"))\n:q' | $SCALAINT \ + -classpath $OUTPUT_DIR 2>> $LOG_FILE 1>> $LOG_FILE)"; + printf "\\n" >> $LOG_FILE # newline + + printf "Interpret $main with current directory as default classpath\\n" + test_run "(cd $OUTPUT_DIR && + printf $main'.main(Array(\"3\"))\n:q' | $SCALAINT \ + 2>> $LOG_FILE 1>> $LOG_FILE)"; + printf "\\n" >> $LOG_FILE # newline + + test_diff "$check.scalaint" "$LOG_FILE"; } ############################################################################## @@ -134,7 +267,10 @@ else TMP_DIR=${TMPDIR-/tmp}/tmp.123 fi -ECHO="echo -e" +TEST_DIR=$PREFIX/test +SOURCE_DIR=$TEST_DIR/files/cli +OUTPUT_DIR=$TMP_DIR/classes + DIFF="diff"; case `uname` in @@ -143,229 +279,110 @@ case `uname` in ;; esac; -LEVEL="silent"; +SCALA=${BIN_DIR}/scala +SCALAC=${BIN_DIR}/scalac +SCALAINT=${BIN_DIR}/scalaint +SUFFIX=".scala" + +DEBUG=""; +LANG=""; +LEVEL=""; while [ $# -gt 0 ]; do case "$1" in - --info ) LEVEL="info"; shift 1;; - --verbose ) LEVEL="verbose"; shift 1;; - --help| -? ) test_print_help; exit 0;; - --version ) test_print_version; exit 0;; - -* ) abort "unknown option $1";; - * ) test_print_usage; exit 0;; + --debug ) DEBUG="debug"; LEVEL="verbose"; shift 1;; + --info ) LEVEL="info"; shift 1;; + --java ) LANG="java"; shift 1;; + --objdir=* ) OUTPUT_DIR=`expr "$1" : "--objdir=\(.*\)"`; shift 1;; + --verbose ) LEVEL="verbose"; shift 1;; + --help ) test_print_help; exit 0;; + --version ) test_print_version; exit 0;; + -* ) abort "unknown option $1";; + * ) test_print_usage; exit 0;; esac; done; -SCALA=${BIN_DIR}/scala -SCALAC=${BIN_DIR}/scalac -SCALAINT=${BIN_DIR}/scalaint +if [ "$LANG" = "java" ] ; then + SCALAC=`which javac` + BIN_DIR=`dirname $SCALAC` + SCALA=$BIN_DIR/java + SUFFIX=".java" +fi +[ -x "$SCALAC" ] || ( printf "Command $SCALAC not found\\n"; exit 1 ); printf_initialization "${COLOR:-many}"; -printf_outline "Test directory is : ${TMP_DIR}\\n"; -printf_outline "Scala binaries in : ${BIN_DIR}\\n"; +printf_outline "Output directory is : $OUTPUT_DIR\\n"; +if [ "$LANG" = "java" ] ; then + printf_outline "Java binaries in : $BIN_DIR\\n"; +else + printf_outline "Scala binaries in : $BIN_DIR\\n"; +fi jvm_version=`${JAVACMD:=java} -version 2>&1 | head -3 | tail -1` -printf_outline "Java runtime is : $jvm_version\\n\\n"; +printf_outline "Java runtime is : $jvm_version\\n"; + +[ `echo "$jvm_version" | grep -c "1.5"` = "1" ] && LANG="java5"; ############################################################################## # Variables -SOURCE_DIR=${TMP_DIR}/src -OUTPUT_DIR=${TMP_DIR}/classes - SCALA_PACKAGE1=test1 SCALA_PACKAGE2=test2 +SCALA_PACKAGE3=test3 SCALA_MAIN1=${SCALA_PACKAGE1}.Main SCALA_MAIN2=${SCALA_PACKAGE2}.Main +SCALA_MAIN3=${SCALA_PACKAGE3}.Main SOURCE_DIR_PACKAGE1=${SOURCE_DIR}/`echo ${SCALA_PACKAGE1} | tr '.' '/'` SOURCE_DIR_PACKAGE2=${SOURCE_DIR}/`echo ${SCALA_PACKAGE2} | tr '.' '/'` +SOURCE_DIR_PACKAGE3=${SOURCE_DIR}/`echo ${SCALA_PACKAGE3} | tr '.' '/'` -SOURCE_FILE1=${SOURCE_DIR_PACKAGE1}/Main.scala -SOURCE_FILE2=${SOURCE_DIR_PACKAGE2}/Main.scala +SOURCE_FILE1=${SOURCE_DIR_PACKAGE1}/Main$SUFFIX +SOURCE_FILE2=${SOURCE_DIR_PACKAGE2}/Main$SUFFIX +SOURCE_FILE3=${SOURCE_DIR_PACKAGE3}/Main$SUFFIX -LOG_FILE=${TMP_DIR}/${SCRIPT}.log -CHECK_FILE=${TMP_DIR}/${SCRIPT}.check +CHECK_FILE1=${SOURCE_DIR_PACKAGE1}/Main.check +CHECK_FILE2=${SOURCE_DIR_PACKAGE2}/Main.check +CHECK_FILE3=${SOURCE_DIR_PACKAGE3}/Main.check -############################################################################## -# Tests - -rm -rf ${TMP_DIR}/* -mkdir -p ${SOURCE_DIR_PACKAGE1} ${SOURCE_DIR_PACKAGE2} -mkdir -p ${OUTPUT_DIR} - -(cat << EOF -package ${SCALA_PACKAGE1} -object Main { - def main(args: Array[String]) = { - val arg = if (args.length > 0) args(0) else "?" - Console.println("1: test " + arg + " passed") - } -} -EOF -) > ${SOURCE_FILE1} +if [ "$DEBUG" = "debug" ] ; then + LOG_FILE=/dev/tty +else + LOG_FILE=${TMP_DIR}/${SCRIPT}.log +fi +DIFF_FILE=${TMP_DIR}/${SCRIPT}.diff +TMP_FILE=${TMP_DIR}/${SCRIPT}.tmp -################################# scalac ##################################### -printf_outline "Test the 'scalac' command\\n" +############################################################################## -printf "\\tCase 0: do not use any classpath information (0 dependency)\\n" -env CLASSAPTH= ${SCALAC} -d ${OUTPUT_DIR} ${SOURCE_FILE1} 2>> ${LOG_FILE} +test_compile "$SOURCE_FILE1" "$CHECK_FILE1" "no dependency"; if [ "$?" = "0" ] ; then - - ################################## scala ################################# - printf_outline "\\nTest the 'scala' command\\n" - - printf "\\tCase 1: use the CLASSPATH environment variable\\n" - env CLASSPATH=${OUTPUT_DIR} ${SCALA} ${SCALA_MAIN1} 1 \ - 1>> ${LOG_FILE} - - printf "\\tCase 2: use the -classpath option\\n" - env CLASSPATH= ${SCALA} -cp ${OUTPUT_DIR} ${SCALA_MAIN1} 2 \ - 1>> ${LOG_FILE} - - printf "\\tCase 3: use the current directory as default classpath\\n" - (cd ${OUTPUT_DIR} && - env CLASSPATH= ${SCALA} ${SCALA_MAIN1} 3 1>> ${LOG_FILE}) - - ############################## scalaint ################################## - printf_outline "\\nTest the 'scalaint' command\\n" - - printf "\\tCase 1: use the CLASSPATH environment variable\\n" - (env CLASSPATH=${OUTPUT_DIR} \ - printf "${SCALA_MAIN1}.main(Array(\"1\"))\n:q" | ${SCALAINT} \ - 1>> ${LOG_FILE}) - printf "\\n" >> ${LOG_FILE} # newline - - printf "\\tCase 2: use the -classpath option\\n" - (env CLASSPATH= \ - printf "${SCALA_MAIN1}.main(Array(\"2\"))\n:q" | ${SCALAINT} \ - -classpath ${OUTPUT_DIR} 1>> ${LOG_FILE}) - printf "\\n" >> ${LOG_FILE} # newline - - printf "\\tCase 3: use the current directory as default classpath\\n" - (cd ${OUTPUT_DIR} && - printf "${SCALA_MAIN1}.main(Array(\"3\"))\n:q" | ${SCALAINT} 1>> ${LOG_FILE}) - printf "\\n" >> ${LOG_FILE} # newline - + test_execute "$SCALA_MAIN1" "$CHECK_FILE1"; + test_interpret "$SCALA_MAIN1" "$CHECK_FILE1"; fi ############################################################################## -(cat << EOF -package ${SCALA_PACKAGE2} -object Main { - def main(args: Array[String]) = { - Console.print("2: ") - ${SCALA_MAIN1}.main(args) - } -} -EOF -) > ${SOURCE_FILE2} - -################################# scalac ##################################### -printf_outline "\\nTest the 'scalac' command\n" - -printf "\\tCase 0: do not use any classpath information (1 dependency)\\n" -env CLASSPATH= ${SCALAC} ${SOURCE_FILE2} 2>> ${LOG_FILE} - -printf "\\tCase 1: use the CLASSPATH environment variable\\n" -env CLASSPATH=${OUTPUT_DIR} ${SCALAC} \ - -d ${OUTPUT_DIR} ${SOURCE_FILE2} 2>> ${LOG_FILE} - -printf "\\tCase 2: use the -classpath option\\n" -env CLASSPATH= ${SCALAC} -classpath ${OUTPUT_DIR} \ - -d ${OUTPUT_DIR} ${SOURCE_FILE2} 2>> ${LOG_FILE} - -printf "\\tCase 3: use the current directory as default classpath\\n" -(cd ${OUTPUT_DIR} && -env CLASSPATH= ${SCALAC} ${SOURCE_FILE2} 2>> ${LOG_FILE}) +test_compile "$SOURCE_FILE2" "$CHECK_FILE2" "1 dependency"; if [ "$?" = "0" ] ; then + test_execute "$SCALA_MAIN2" "$CHECK_FILE2"; + test_interpret "$SCALA_MAIN2" "$CHECK_FILE2"; +fi - ############################## scala ##################################### - printf_outline "\\nTest the 'scala' command\\n" - - printf "\\tCase 1: use the CLASSPATH environment variable\\n" - env CLASSPATH=${OUTPUT_DIR} ${SCALA} ${SCALA_MAIN2} 1 \ - 1>> ${LOG_FILE} - - printf "\\tCase 2: use the -classpath option\\n" - env CLASSPATH= ${SCALA} -cp ${OUTPUT_DIR} ${SCALA_MAIN2} 2 \ - 1>> ${LOG_FILE} +############################################################################## - printf "\\tCase 3: use the current directory as default classpath\\n" - (cd ${OUTPUT_DIR} && - env CLASSPATH= ${SCALA} ${SCALA_MAIN2} 3 1>> ${LOG_FILE}) +test_compile "$SOURCE_FILE3" "$CHECK_FILE3" "2 dependencies"; +if [ "$?" = "0" ] ; then + test_execute "$SCALA_MAIN3" "$CHECK_FILE3"; + test_interpret "$SCALA_MAIN3" "$CHECK_FILE3"; fi ############################################################################## -# Check file - -(cat << EOF -1: test 1 passed -1: test 2 passed -1: test 3 passed -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :quit to exit the interpreter. -Type :compile followed by a filename to compile a complete Scala file. -Type :load followed by a filename to load a sequence of interpreter commands. -Type :help to repeat this message later. - -scala> 1: test 1 passed -line0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :quit to exit the interpreter. -Type :compile followed by a filename to compile a complete Scala file. -Type :load followed by a filename to load a sequence of interpreter commands. -Type :help to repeat this message later. - -scala> 1: test 2 passed -line0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :quit to exit the interpreter. -Type :compile followed by a filename to compile a complete Scala file. -Type :load followed by a filename to load a sequence of interpreter commands. -Type :help to repeat this message later. - -scala> 1: test 3 passed -line0: scala.Unit = () - -scala> -${TMP_DIR}/src/test2/Main.scala:5 error: not found: value test1 - test1.Main.main(args) - ^ -one error found -2: 1: test 1 passed -2: 1: test 2 passed -2: 1: test 3 passed -EOF -) > ${CHECK_FILE} - -printf_outline "\\nDifferences between check file and log file:\\n" -${DIFF} ${CHECK_FILE} ${LOG_FILE} - -############################################################################## # Epilog -if [ "$LEVEL" = "info" ] ; then - printf_outline "\\nSource files:\\n" - cat ${SOURCE_FILE1} ${SOURCE_FILE2} -elif [ "$LEVEL" = "verbose" ] ; then - printf_outline "\\nSource files:\\n" - cat ${SOURCE_FILE1} ${SOURCE_FILE2} - printf_outline "\\nTest directory:\\n" - tree ${TMP_DIR} -fi - -rm -rf ${TMP_DIR} +rm -rf $TMP_DIR ############################################################################## diff --git a/test/files/cli/test1/Main.check.javac b/test/files/cli/test1/Main.check.javac new file mode 100644 index 0000000000..ba25d9b6ca --- /dev/null +++ b/test/files/cli/test1/Main.check.javac @@ -0,0 +1,19 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -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 + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -help Print a synopsis of standard options + diff --git a/test/files/cli/test1/Main.check.javac5 b/test/files/cli/test1/Main.check.javac5 new file mode 100644 index 0000000000..0cb29d31ff --- /dev/null +++ b/test/files/cli/test1/Main.check.javac5 @@ -0,0 +1,24 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -classpath <path> Specify where to find user class files + -cp <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 + -endorseddirs <dirs> Override location of endorsed standards path + -d <directory> Specify where to place generated class files + -encoding <encoding> Specify character encoding used by source files + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -version Version information + -help Print a synopsis of standard options + -X Print a synopsis of nonstandard options + -J<flag> Pass <flag> directly to the runtime system + diff --git a/test/files/cli/test1/Main.check.scala b/test/files/cli/test1/Main.check.scala new file mode 100644 index 0000000000..12cf928e58 --- /dev/null +++ b/test/files/cli/test1/Main.check.scala @@ -0,0 +1,5 @@ +Unrecognized option: -cpp +Could not create the Java virtual machine. +1: test 1 passed +1: test 2 passed +1: test 3 passed diff --git a/test/files/cli/test1/Main.check.scalac b/test/files/cli/test1/Main.check.scalac new file mode 100644 index 0000000000..42ef754181 --- /dev/null +++ b/test/files/cli/test1/Main.check.scalac @@ -0,0 +1,46 @@ +scalac error: unknown option: '-dd' + scalac -help gives more information +Usage: scalac <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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + +one error found diff --git a/test/files/cli/test1/Main.check.scalaint b/test/files/cli/test1/Main.check.scalaint new file mode 100644 index 0000000000..99224cae31 --- /dev/null +++ b/test/files/cli/test1/Main.check.scalaint @@ -0,0 +1,81 @@ +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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + + +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 1: test 1 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 1: test 2 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 1: test 3 passed +line0: scala.Unit = () + +scala> diff --git a/test/files/cli/test1/Main.java b/test/files/cli/test1/Main.java new file mode 100644 index 0000000000..11d50255dd --- /dev/null +++ b/test/files/cli/test1/Main.java @@ -0,0 +1,7 @@ +package test1; +public class Main { + public static void main(String args[]) { + String arg = (args.length > 0) ? args[0] : "?"; + System.out.println("1: test " + arg + " passed"); + } +} diff --git a/test/files/cli/test1/Main.scala b/test/files/cli/test1/Main.scala new file mode 100644 index 0000000000..9958d6a54c --- /dev/null +++ b/test/files/cli/test1/Main.scala @@ -0,0 +1,7 @@ +package test1 +object Main { + def main(args: Array[String]) = { + val arg = if (args.length > 0) args(0) else "?" + Console.println("1: test " + arg + " passed") + } +} diff --git a/test/files/cli/test2/Main.check.javac b/test/files/cli/test2/Main.check.javac new file mode 100644 index 0000000000..c25714eabb --- /dev/null +++ b/test/files/cli/test2/Main.check.javac @@ -0,0 +1,27 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -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 + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -help Print a synopsis of standard options + +files/cli/test2/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +1 error +files/cli/test2/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +1 error diff --git a/test/files/cli/test2/Main.check.javac5 b/test/files/cli/test2/Main.check.javac5 new file mode 100644 index 0000000000..d20df8ffe7 --- /dev/null +++ b/test/files/cli/test2/Main.check.javac5 @@ -0,0 +1,32 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -classpath <path> Specify where to find user class files + -cp <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 + -endorseddirs <dirs> Override location of endorsed standards path + -d <directory> Specify where to place generated class files + -encoding <encoding> Specify character encoding used by source files + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -version Version information + -help Print a synopsis of standard options + -X Print a synopsis of nonstandard options + -J<flag> Pass <flag> directly to the runtime system + +files/cli/test2/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +1 error +files/cli/test2/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +1 error diff --git a/test/files/cli/test2/Main.check.scala b/test/files/cli/test2/Main.check.scala new file mode 100644 index 0000000000..8929b20b08 --- /dev/null +++ b/test/files/cli/test2/Main.check.scala @@ -0,0 +1,5 @@ +Unrecognized option: -cpp +Could not create the Java virtual machine. +2: 1: test 1 passed +2: 1: test 2 passed +2: 1: test 3 passed diff --git a/test/files/cli/test2/Main.check.scalac b/test/files/cli/test2/Main.check.scalac new file mode 100644 index 0000000000..2cf40d5de8 --- /dev/null +++ b/test/files/cli/test2/Main.check.scalac @@ -0,0 +1,50 @@ +scalac error: unknown option: '-dd' + scalac -help gives more information +Usage: scalac <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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + +one error found +files/cli/test2/Main.scala:5 error: not found: value test1 + test1.Main.main(args) + ^ +one error found diff --git a/test/files/cli/test2/Main.check.scalaint b/test/files/cli/test2/Main.check.scalaint new file mode 100644 index 0000000000..2719b50b7d --- /dev/null +++ b/test/files/cli/test2/Main.check.scalaint @@ -0,0 +1,81 @@ +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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + + +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 2: 1: test 1 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 2: 1: test 2 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 2: 1: test 3 passed +line0: scala.Unit = () + +scala> diff --git a/test/files/cli/test2/Main.java b/test/files/cli/test2/Main.java new file mode 100644 index 0000000000..808fdd7cda --- /dev/null +++ b/test/files/cli/test2/Main.java @@ -0,0 +1,7 @@ +package test2; +public class Main { + public static void main(String args[]) { + System.out.print("2: "); + test1.Main.main(args); + } +} diff --git a/test/files/cli/test2/Main.scala b/test/files/cli/test2/Main.scala new file mode 100644 index 0000000000..7c7f4fd86e --- /dev/null +++ b/test/files/cli/test2/Main.scala @@ -0,0 +1,7 @@ +package test2 +object Main { + def main(args: Array[String]) = { + Console.print("2: ") + test1.Main.main(args) + } +} diff --git a/test/files/cli/test3/Main.check.javac b/test/files/cli/test3/Main.check.javac new file mode 100644 index 0000000000..0a2e2de023 --- /dev/null +++ b/test/files/cli/test3/Main.check.javac @@ -0,0 +1,33 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -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 + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -help Print a synopsis of standard options + +files/cli/test3/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +files/cli/test3/Main.java:7: package test2 does not exist + test2.Main.main(args); + ^ +2 errors +files/cli/test3/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +files/cli/test3/Main.java:7: package test2 does not exist + test2.Main.main(args); + ^ +2 errors diff --git a/test/files/cli/test3/Main.check.javac5 b/test/files/cli/test3/Main.check.javac5 new file mode 100644 index 0000000000..f97ed7066b --- /dev/null +++ b/test/files/cli/test3/Main.check.javac5 @@ -0,0 +1,38 @@ +javac: invalid flag: -dd +Usage: javac <options> <source files> +where possible options include: + -g Generate all debugging info + -g:none Generate no debugging info + -g:{lines,vars,source} Generate only some debugging info + -nowarn Generate no warnings + -verbose Output messages about what the compiler is doing + -deprecation Output source locations where deprecated APIs are used + -classpath <path> Specify where to find user class files + -cp <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 + -endorseddirs <dirs> Override location of endorsed standards path + -d <directory> Specify where to place generated class files + -encoding <encoding> Specify character encoding used by source files + -source <release> Provide source compatibility with specified release + -target <release> Generate class files for specific VM version + -version Version information + -help Print a synopsis of standard options + -X Print a synopsis of nonstandard options + -J<flag> Pass <flag> directly to the runtime system + +files/cli/test3/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +files/cli/test3/Main.java:7: package test2 does not exist + test2.Main.main(args); + ^ +2 errors +files/cli/test3/Main.java:5: package test1 does not exist + test1.Main.main(args); + ^ +files/cli/test3/Main.java:7: package test2 does not exist + test2.Main.main(args); + ^ +2 errors diff --git a/test/files/cli/test3/Main.check.scala b/test/files/cli/test3/Main.check.scala new file mode 100644 index 0000000000..d920b45a05 --- /dev/null +++ b/test/files/cli/test3/Main.check.scala @@ -0,0 +1,8 @@ +Unrecognized option: -cpp +Could not create the Java virtual machine. +3: 1: test 1 passed +3: 2: 1: test 1 passed +3: 1: test 2 passed +3: 2: 1: test 2 passed +3: 1: test 3 passed +3: 2: 1: test 3 passed diff --git a/test/files/cli/test3/Main.check.scalac b/test/files/cli/test3/Main.check.scalac new file mode 100644 index 0000000000..71d2ab1cbd --- /dev/null +++ b/test/files/cli/test3/Main.check.scalac @@ -0,0 +1,50 @@ +scalac error: unknown option: '-dd' + scalac -help gives more information +Usage: scalac <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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + +one error found +files/cli/test3/Main.scala:5 error: not found: value test1 + test1.Main.main(args) + ^ +one error found diff --git a/test/files/cli/test3/Main.check.scalaint b/test/files/cli/test3/Main.check.scalaint new file mode 100644 index 0000000000..9b5d479db0 --- /dev/null +++ b/test/files/cli/test3/Main.check.scalaint @@ -0,0 +1,84 @@ +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 + -target:<target> Specify which backend to use (jvm,msil) + -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 + -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) + -Xgenerics Use generic Java types + + +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 3: 1: test 1 passed +3: 2: 1: test 1 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 3: 1: test 2 passed +3: 2: 1: test 2 passed +line0: scala.Unit = () + +scala> +This is an interpreter for Scala. +Type in expressions to have them evaluated. +Type :quit to exit the interpreter. +Type :compile followed by a filename to compile a complete Scala file. +Type :load followed by a filename to load a sequence of interpreter commands. +Type :replay to reset execution and replay all previous commands. +Type :help to repeat this message later. + +scala> 3: 1: test 3 passed +3: 2: 1: test 3 passed +line0: scala.Unit = () + +scala> diff --git a/test/files/cli/test3/Main.java b/test/files/cli/test3/Main.java new file mode 100644 index 0000000000..41cafefa55 --- /dev/null +++ b/test/files/cli/test3/Main.java @@ -0,0 +1,9 @@ +package test3; +public class Main { + public static void main(String args[]) { + System.out.print("3: "); + test1.Main.main(args); + System.out.print("3: "); + test2.Main.main(args); + } +}
\ No newline at end of file diff --git a/test/files/cli/test3/Main.scala b/test/files/cli/test3/Main.scala new file mode 100644 index 0000000000..2d38e438f6 --- /dev/null +++ b/test/files/cli/test3/Main.scala @@ -0,0 +1,9 @@ +package test3 +object Main { + def main(args: Array[String]) = { + Console.print("3: ") + test1.Main.main(args) + Console.print("3: ") + test2.Main.main(args) + } +}
\ No newline at end of file |