r17547: Add test by mkhl for some of our variable substituion behaviour.
authorAndrew Bartlett <abartlet@samba.org>
Tue, 15 Aug 2006 02:25:10 +0000 (02:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:15:36 +0000 (14:15 -0500)
Andrew Bartlett

source/script/tests/test_ejs.sh
testprogs/ejs/base.js [new file with mode: 0755]

index aabefcf233be829ca9f6dbeb58c83323659ccf2f..3ad3ed2781f1591911e9ddf20cf74822c3941ba2 100755 (executable)
@@ -21,6 +21,8 @@ DATADIR=../testdata
 PATH=bin:$PATH
 export PATH
 
 PATH=bin:$PATH
 export PATH
 
+testit "base.js" $SCRIPTDIR/base.js || failed=`expr $failed + 1`
+
 for f in samr.js echo.js; do
     testit "$f" $SCRIPTDIR/$f $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD || failed=`expr $failed + 1`
 done
 for f in samr.js echo.js; do
     testit "$f" $SCRIPTDIR/$f $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD || failed=`expr $failed + 1`
 done
diff --git a/testprogs/ejs/base.js b/testprogs/ejs/base.js
new file mode 100755 (executable)
index 0000000..fddf642
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+exec smbscript "$0" ${1+"$@"}
+libinclude("base.js");
+
+var obj = new Object();
+obj.FOO = "foo";
+obj.BAR = "bar";
+var str1 = "${FOO}:${BAR}";
+var str2 = "${FOO}:${BAR} "; // note the space after the brace
+var sub1 = substitute_var(str1, obj);
+var sub2 = substitute_var(str2, obj);
+
+assert(str1 + " " == str2);
+assert(sub1 + " " == sub2);
+exit(0);