*/
function url(value) {
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
-}
\ No newline at end of file
+}
+
+/**
+ * Checks that the first two arguments are equal, with an optional message.
+ * Prints out both expected and actual values on failure.
+ *
+ * Prefered to ok( expected == actual, message )
+ *
+ * @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) );
+ *
+ * @param Object expected
+ * @param Object actual
+ * @param String message (optional)
+ */
+function equals(expected, actual, message) {
+ var result = expected == actual;
+ message = message || result ? "okay" : "failed";
+ _config.Test.push( [ result, result ? message + ": " + expected : message + " expected: " + expected + " actual: " + actual ] );
+}
ok( $('#name').attr('name') == "name", 'Check for name attribute' );\r
ok( $('#text1').attr('name') == "action", 'Check for name attribute' );\r
ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );\r
- ok( $('#anchor2').attr('href') == "#2", 'Check for non-absolute href (an anchor)' );\r
+ equals( "#2", $('#anchor2').attr('href'), 'Check for non-absolute href (an anchor)' );\r
stop();\r
$.get("data/dashboard.xml", function(xml) {\r
ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );\r