svn commit: samba r8346 - in branches/SAMBA_4_0/testprogs/ejs: .

tridge at samba.org tridge at samba.org
Tue Jul 12 05:58:41 GMT 2005


Author: tridge
Date: 2005-07-12 05:58:41 +0000 (Tue, 12 Jul 2005)
New Revision: 8346

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8346

Log:
added a sprintf test suite for ejs


Added:
   branches/SAMBA_4_0/testprogs/ejs/sprintf.js


Changeset:
Added: branches/SAMBA_4_0/testprogs/ejs/sprintf.js
===================================================================
--- branches/SAMBA_4_0/testprogs/ejs/sprintf.js	2005-07-12 05:57:56 UTC (rev 8345)
+++ branches/SAMBA_4_0/testprogs/ejs/sprintf.js	2005-07-12 05:58:41 UTC (rev 8346)
@@ -0,0 +1,22 @@
+#!/usr/bin/env smbscript
+/*
+	test sprintf function
+*/
+
+function check_result(s, v)
+{
+	if (s != v) {
+		println("expected '" + v + "' but got '" + s + "'");
+	}
+	assert(s == v);
+}
+
+check_result(sprintf("%d", 7), "7");
+check_result(sprintf("%04d", 42), "0042");
+check_result(sprintf("my string=%7.2s", "foo%7"), "my string=     fo");
+check_result(sprintf("blah=0x%*x", 4, 19), "blah=0x  13");
+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%");
+
+println("ALL OK");


Property changes on: branches/SAMBA_4_0/testprogs/ejs/sprintf.js
___________________________________________________________________
Name: svn:executable
   + *



More information about the samba-cvs mailing list