[SCM] Lisaac compiler branch, master+stable, updated. lisaac-0.12-606-gf445725

Mildred Ki'Lya silkensedai at online.fr
Mon Mar 1 00:35:21 UTC 2010


The following commit has been merged in the master+stable branch:
commit 62e9b72ed5edb51d285c08a993eb86d9136a3a93
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date:   Fri Oct 9 17:32:30 2009 +0200

    Added framework for tests and a test ambiguous_proto

diff --git a/run-tests.sh b/run-tests.sh
new file mode 100755
index 0000000..9722d6f
--- /dev/null
+++ b/run-tests.sh
@@ -0,0 +1,92 @@
+#! /bin/bash
+
+self="$(cd "$(dirname "$0")"; pwd)/$(basename "$0")"
+op_default=true
+op_runcwd=false
+op_testname="`pwd`"
+
+while [ $# -gt 0 ]; do
+  case "$1" in
+    -d)
+      cd "$2"
+      op_testname="$2"
+      op_default=false
+      op_runcwd=true
+      shift 2
+      ;;
+    *)
+      shift
+      break
+      ;;
+  esac
+done
+
+if $op_default; then
+  cd "`dirname "$0"`"
+  n=0
+  failed=()
+  for f in tests/*; do
+    if [ -d "$f" ]; then
+      "$self" -d "$f"
+      res=$?
+      if [ $res != 0 ]; then
+        failed=("${failed[@]}" $f)
+      fi
+      n=$(($n+$res))
+    fi
+  done
+  echo
+  if [ $n = 0 ]; then
+    echo "*** SUCCESS ***"
+  else
+    echo "*** FAILURE ***"
+    for f in "${failed[@]}"; do
+      echo " - $f"
+    done
+    echo
+  fi
+  exit $n
+fi
+
+header(){
+  local max="$1"
+  local char="$2"
+  local title="$3"
+  if [ -z "$title" ]; then
+    local ruler_len=$(( $max / ${#char} ))
+  else
+    local ruler_len=$(( ( $max - ${#title} - 2 ) / ( 2 * ${#char} ) ))
+  fi
+  local ruler="$(printf "%${ruler_len}s" "")"
+  local ruler="${ruler// /$char}"
+  if [ -z "$title" ]; then
+    echo "$ruler"
+  else
+    if [ $(( ( max - ${#title} ) % 2 )) = 1 ]; then
+      echo "$ruler $title  $ruler"
+    else
+      echo "$ruler $title $ruler"
+    fi
+  fi
+}
+
+if $op_runcwd; then
+  res=1
+  echo
+  header 80 '*' "$op_testname"
+  #echo "******************** $op_testname ********************"
+  if [ -f test.sh -a -x test.sh ]; then
+    ./test.sh
+    res=$?
+  else
+    echo "Unknown test: $op_testname"
+  fi
+  header 80 '*'
+  if [ $res != 0 ]; then
+    header 80 ' ' "error: $res"
+  fi
+  echo
+  exit $res
+fi
+
+exit 0
diff --git a/tests/ambiguous_protoname/dir1/proto.li b/tests/ambiguous_protoname/dir1/proto.li
new file mode 100644
index 0000000..374f538
--- /dev/null
+++ b/tests/ambiguous_protoname/dir1/proto.li
@@ -0,0 +1,7 @@
+Section Header
+
+  + name := PROTO;
+
+Section Inherit
+
+  + parent :Expanded OBJECT;
diff --git a/tests/ambiguous_protoname/dir2/proto.li b/tests/ambiguous_protoname/dir2/proto.li
new file mode 100644
index 0000000..374f538
--- /dev/null
+++ b/tests/ambiguous_protoname/dir2/proto.li
@@ -0,0 +1,7 @@
+Section Header
+
+  + name := PROTO;
+
+Section Inherit
+
+  + parent :Expanded OBJECT;
diff --git a/tests/ambiguous_protoname/main.li b/tests/ambiguous_protoname/main.li
new file mode 100644
index 0000000..4d7edd3
--- /dev/null
+++ b/tests/ambiguous_protoname/main.li
@@ -0,0 +1,15 @@
+Section Header
+
+  + name := MAIN;
+
+Section Public
+
+  - main <-
+  ( + a0 :PROTO;
+    + a1 :DIR1.PROTO;
+    + a2 :DIR2.PROTO;
+    a1.println;
+    a2.println;
+    "Hello".println;
+    a0.toto;
+  );
diff --git a/tests/ambiguous_protoname/make.lip b/tests/ambiguous_protoname/make.lip
new file mode 100644
index 0000000..d7c9289
--- /dev/null
+++ b/tests/ambiguous_protoname/make.lip
@@ -0,0 +1,12 @@
+Section Inherit
+
+  + parent :STRING;
+
+Section Private
+
+  - front_end <-
+  (
+    general_front_end;
+    path "./*";
+    input_file := "main";
+  );
diff --git a/tests/ambiguous_protoname/proto.li b/tests/ambiguous_protoname/proto.li
new file mode 100644
index 0000000..374f538
--- /dev/null
+++ b/tests/ambiguous_protoname/proto.li
@@ -0,0 +1,7 @@
+Section Header
+
+  + name := PROTO;
+
+Section Inherit
+
+  + parent :Expanded OBJECT;
diff --git a/tests/ambiguous_protoname/test.sh b/tests/ambiguous_protoname/test.sh
new file mode 100755
index 0000000..cf5cb02
--- /dev/null
+++ b/tests/ambiguous_protoname/test.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+
+echo "Test if the error message contains non ambiguous prototype names"
+
+expected="Slot \`toto' not found in \`AMBIGUOUS_PROTONAME.PROTO'."
+
+out="$(lisaac 2>&1)"
+grep -q "$expected" <<<"$out" || \
+{
+  echo
+  echo "Expected: "
+  echo "$expected"
+  echo
+  echo "$out"
+  exit 1
+}
+
+exit $?

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list