 assert(rpad("Hello", ".", 7) == "Hello..");
 assert(rpad("Hello", " ", 3) == "Hello");
 assert(rpad("Hello", " ", -1) == "Hello");
-try
-{
-    rpad("Hello", "", 7);
-    assert(false);
-}
-catch(e)
-{
-    assert(true);
-}
-try
-{
-    rpad("Hello", "abcd", 7);
-    assert(false);
-}
-catch(e)
-{
-    assert(true);
-}
+assertThrows(function () { rpad("Hello", "", 7); });
+assertThrows(function () { rpad("Hello", "abcd", 7); });
 
 var startsWith = str.startsWith;
 assert(startsWith("Banana", "Ban"));

assert(parseInt("-123", 10) == -123);
assert(parseInt("a", 16) == 10);
assert(parseInt("1010", 2) == 10);

try
{
    parseInt("", 10);
    assert(false);
}
catch(e)
{
    assert(true);
}
try
{
    parseInt("123abc", 10);
    assert(false);
}
catch(e)
{
    assert(true);
}

var parseFloat = str.parseFloat;
assert (parseFloat("0") == 0.0f);

#language "lang/plush/0"

var str = import "std/string/0";
var array = import "std/array/0";
var arrayEq = array.arrayEq;

var assertThrows = function (fun)
{
    var threw = false;
    try
    {
        fun();
    }
    catch (e)
    {
        threw = true;
    }
    assert (threw);
};

var indexOf = str.indexOf;
