1 #!/usr/bin/env smbscript
8 function check_result(s, v)
11 println("expected '" + v + "' but got '" + s + "'");
18 return "XX{" + vsprintf(arguments) + "}XX";
21 check_result(sprintf("%d", 7), "7");
22 check_result(sprintf("%04d", 42), "0042");
23 check_result(sprintf("my string=%7.2s", "foo%7"), "my string= fo");
24 check_result(sprintf("blah=0x%*x", 4, 19), "blah=0x 13");
25 check_result(sprintf("blah=0x%0*x", 4, 19), "blah=0x0013");
26 check_result(sprintf("blah=%.0f", 1032), "blah=1032");
27 check_result(sprintf("%4.2f%%", 72.32), "72.32%");
29 check_result(xprintf("%4.2f%% and %s", 72.32, "foo"),"XX{72.32% and foo}XX");