diff options
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/ejs/bugs.js | 34 | ||||
-rwxr-xr-x | testprogs/ejs/sprintf.js | 7 |
2 files changed, 40 insertions, 1 deletions
diff --git a/testprogs/ejs/bugs.js b/testprogs/ejs/bugs.js index 01174f9eaf..3c8a4daab3 100644 --- a/testprogs/ejs/bugs.js +++ b/testprogs/ejs/bugs.js @@ -8,6 +8,7 @@ /**************************************** demo a bug in constructing arrays fix at http://build.samba.org/build.pl?function=diff;tree=samba4;revision=7124 +status: FIXED *****************************************/ function arraybug() { var a; @@ -38,6 +39,7 @@ function arraybug() { /**************************************** demo a bug in variable arguments fix at http://build.samba.org/build.pl?function=diff;tree=samba4;revision=7085 +status: FIXED *****************************************/ function argsbug() { println("we should have been called with 3 arguments"); @@ -51,6 +53,7 @@ function argsbug() { /**************************************** demo a bug in constructing objects no fix available yet +status: SUBMITTED *****************************************/ function MyObj() { var o = new Object(); @@ -68,10 +71,23 @@ function objbug() { assert(o2.test == 42); } +/* + demo a expression handling bug + status: SUBMITTED +*/ +function exprbug() { + var a = new Array(10); + var i; + for (i=0;i<4;i++) { + a[1+(i*2)] = i; + a[2+(i*2)] = i*2; + } +} /**************************************** demo lack of recursion fix in http://build.samba.org/build.pl?function=diff;tree=samba4;revision=7127 +status: FIXED *****************************************/ function fibonacci(n) { if (n < 3) { @@ -87,9 +103,25 @@ function recursebug() { } } +/**************************************** +demo lack of function variables inside functions +status: FIXED IN SAMBA +*****************************************/ +function callback() +{ + return "testing"; +} + +function fnbug(c) +{ + s = c(); + assert(s == "testing"); +} /* run the tests */ arraybug(); argsbug("one", "two", "three"); recursebug(); -objbug() +exprbug(); +fnbug(callback); +objbug(); diff --git a/testprogs/ejs/sprintf.js b/testprogs/ejs/sprintf.js index 34df4f9a42..4d3d9a7555 100755 --- a/testprogs/ejs/sprintf.js +++ b/testprogs/ejs/sprintf.js @@ -11,6 +11,11 @@ function check_result(s, v) assert(s == v); } +function xprintf() +{ + return "XX{" + vsprintf(arguments) + "}XX"; +} + check_result(sprintf("%d", 7), "7"); check_result(sprintf("%04d", 42), "0042"); check_result(sprintf("my string=%7.2s", "foo%7"), "my string= fo"); @@ -19,4 +24,6 @@ check_result(sprintf("blah=0x%0*x", 4, 19), "blah=0x0013"); check_result(sprintf("blah=%.0f", 1032), "blah=1032"); check_result(sprintf("%4.2f%%", 72.32), "72.32%"); +check_result(xprintf("%4.2f%% and %s", 72.32, "foo"),"XX{72.32% and foo}XX"); + println("ALL OK"); |