aboutsummaryrefslogtreecommitdiffhomepage
path: root/libslang/src/test/selfload.sl
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-14 04:55:05 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-14 04:55:05 +0200
commit6aa0e0017d7d0cddc006da885946934b06949a91 (patch)
tree66b688ec32e2f91266db760b1762f2a50cc52036 /libslang/src/test/selfload.sl
parenta966db5b71328f6adf9dd767e64b322a3bd7ed9c (diff)
downloaderlang-slang-fork-6aa0e0017d7d0cddc006da885946934b06949a91.tar.gz
include libslang-1.4.9 and automatically build it and link erlang-slang against it
few (erlang) people will still have libslang-1.4.9 installed or spend time to get it to link against the driver
Diffstat (limited to 'libslang/src/test/selfload.sl')
-rw-r--r--libslang/src/test/selfload.sl42
1 files changed, 42 insertions, 0 deletions
diff --git a/libslang/src/test/selfload.sl b/libslang/src/test/selfload.sl
new file mode 100644
index 0000000..a360a29
--- /dev/null
+++ b/libslang/src/test/selfload.sl
@@ -0,0 +1,42 @@
+% This is also a good test to perform leak checking on.
+_debug_info = 1; () = evalfile ("inc.sl");
+
+print ("Testing recursive function modifications ...");
+
+variable X = "";
+
+variable V1 = "define crash () { eval(V2); X += \"V1\"; }";
+variable V2 = "define crash () { eval(V1); X += \"V2\"; }";
+
+define crash ();
+
+define crash ()
+{
+ eval (V1);
+ crash ();
+ if (X != "V1")
+ failed ("V1");
+
+ if (1)
+ {
+ eval (V2);
+ crash ();
+ if (X != "V1V2")
+ failed ("V1V2");
+
+ if (1)
+ eval (V1);
+ crash ();
+ if (X != "V1V2V1")
+ failed ("V1V2V1");
+ }
+ X += "V0";
+}
+
+crash ();
+if (X != "V1V2V1V0") failed ("V1V2V1V0 : ", + X);
+
+print ("Ok\n");
+exit (0);
+
+