 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"));

#language "lang/plush/0"

var str = import "std/string/0";

//Utility functions
var arrayeq = function(a, b)
{
    if (a.length != b.length)
    {
        return false;
    }
    for (var i = 0; i < a.length; i += 1)
    {
        if (a[i] != b[i])
        {
            return false;
        }
    }
    return true;
};

var indexOf = str.indexOf;


//split
var split = str.split;
assert(arrayEq(split("a,b,c,d", ","), ["a", "b", "c", "d"]));
assert(arrayEq(split("a,,c,d", ","), ["a", "c", "d"]));
assert(arrayEq(split("a,b,c,", ","), ["a", "b", "c"]));
assert(arrayEq(split(",b,c,d", ","), ["b", "c", "d"]));
assert(arrayEq(split("a,,b,,c,,d", ",,"), ["a", "b", "c", "d"]));
assert(arrayEq(split("a,,,,c,,d", ",,"), ["a", "c", "d"]));
assert(arrayEq(split("a,,b,,c,,", ",,"), ["a", "b", "c"]));
assert(arrayEq(split(",,b,,c,,d", ",,"), ["b", "c", "d"]));
assert(arrayEq(split("", ""), []));
assert(arrayEq(split("", "abc"), []));
assert(arrayEq(split("abc", "abc"), []));
assert(arrayEq(split("abc", "defg"), ["abc"]));

//join
var join = str.join;
