2011-01-20 Dirk Pranke <dpranke@chromium.org>
[WebKit.git] / Tools / Scripts / webkitpy / layout_tests / layout_package / test_failures_unittest.py
index 3e3528dc7807494a0a7eabe413234a6e673ce330..c5aa2d6cecf62c1a3509e18b6745153abf80fa9f 100644 (file)
@@ -80,5 +80,21 @@ class Test(unittest.TestCase):
         for c in ALL_FAILURE_CLASSES:
             self.assert_loads(c)
 
+    def test_equals(self):
+        self.assertEqual(FailureCrash(), FailureCrash())
+        self.assertNotEqual(FailureCrash(), FailureTimeout())
+        crash_set = set([FailureCrash(), FailureCrash()])
+        self.assertEqual(len(crash_set), 1)
+        # The hash happens to be the name of the class, but sets still work:
+        crash_set = set([FailureCrash(), "FailureCrash"])
+        self.assertEqual(len(crash_set), 2)
+
+    def test_relative_output_filename(self):
+        # This could be any Failure* object, since we're testing a method
+        # on the base class.
+        failure_obj = FailureTextMismatch()
+        actual_filename = failure_obj.relative_output_filename("fast/html/article-element.html", "-actual.txt")
+        self.assertEquals(actual_filename, "fast/html/article-element-actual.txt")
+
 if __name__ == '__main__':
     unittest.main()