core_testing2/docdiff_test.sh
changeset 470 195ad66315d9
parent 401 317e49b9cab6
child 474 8a61bcd51ec3
equal deleted inserted replaced
469:ed7a9ea24f71 470:195ad66315d9
     9 echo "" > $out
     9 echo "" > $out
    10 
    10 
    11 echo "Below is the feedback for your submission docdiff.scala" >> $out
    11 echo "Below is the feedback for your submission docdiff.scala" >> $out
    12 echo "" >> $out
    12 echo "" >> $out
    13 
    13 
    14 
       
    15 # compilation tests
    14 # compilation tests
    16 
    15 
    17 function scala_compile {
    16 function scala_compile {
    18   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -Xprint:parser "$1" 2> c$out 1> c$out)
    17   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala-cli compile "$1" 2> c$out 1> c$out)
    19 }
    18 }
    20 
    19 
    21 # functional tests
    20 # functional tests
    22 
    21 
    23 function scala_assert {
    22 function scala_assert {
    24   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" -e "" 2> /dev/null 1> /dev/null)
    23   (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala-cli -i "$1" "$2" -e "urbanmain()" 2> /dev/null 1> /dev/null)
    25 }
    24 }
    26 
    25 
    27 # purity test
    26 # purity test
    28 
       
    29 function scala_vars {
    27 function scala_vars {
    30    (egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' c$out 2> /dev/null 1> /dev/null)
    28    (sed 's/immutable/ok/g' c$out > cb$out;
       
    29     egrep '\bvar\b|\breturn\b|\.par\.|\.par |ListBuffer|AtomicInteger|mutable|util.control|new Array' cb$out 2> /dev/null 1> /dev/null)
    31 }
    30 }
    32 
    31 
    33 
    32 
    34 
    33 
    35 ### compilation test
    34 ### compilation test
    40 then
    39 then
    41     echo -e "  --> passed" >> $out
    40     echo -e "  --> passed" >> $out
    42     tsts=$(( 0 ))
    41     tsts=$(( 0 ))
    43 else
    42 else
    44     echo -e "  --> SCALA DID NOT RUN docdiff.scala\n" >> $out
    43     echo -e "  --> SCALA DID NOT RUN docdiff.scala\n" >> $out
       
    44     echo -e "  --> try running scala-cli compile docdiff.scala on your own computer\n" >> $out
    45     tsts=$(( 1 )) 
    45     tsts=$(( 1 )) 
    46 fi
    46 fi
    47 
    47 
    48 
    48 
    49 # var, .par return, ListBuffer test
    49 # var, .par return, ListBuffer test