Changeset 47040 in webkit


Ignore:
Timestamp:
Aug 11, 2009 11:27:47 AM (15 years ago)
Author:
eric@webkit.org
Message:

2009-08-11 Eric Seidel <eric@webkit.org>

Reviewed by Darin Adler.

Exception in land-patches
https://bugs.webkit.org/show_bug.cgi?id=27962

Use ("%s" % object) instead of ("" + object).
Added unit tests for logging.py.

  • Scripts/modules/logging.py:
  • Scripts/modules/logging_unittest.py: Added.
  • Scripts/run-webkit-unittests:
Location:
trunk/WebKitTools
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r47039 r47040  
     12009-08-11  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Exception in land-patches
     6        https://bugs.webkit.org/show_bug.cgi?id=27962
     7
     8        Use ("%s" % object) instead of ("" + object).
     9        Added unit tests for logging.py.
     10
     11        * Scripts/modules/logging.py:
     12        * Scripts/modules/logging_unittest.py: Added.
     13        * Scripts/run-webkit-unittests:
     14
    1152009-08-11  Dmitry Titov  <dimich@chromium.org>
    216
  • trunk/WebKitTools/Scripts/modules/logging.py

    r45725 r47040  
    3636
    3737def error(string):
    38     log("ERROR: " + string)
     38    log("ERROR: %s" % string)
    3939    exit(1)
  • trunk/WebKitTools/Scripts/modules/logging_unittest.py

    • Property svn:executable deleted
    r47039 r47040  
    1 #!/usr/bin/python
    2 # Copyright (c) 2009 Google Inc. All rights reserved.
     1# Copyright (C) 2009 Google Inc. All rights reserved.
    32#
    43# Redistribution and use in source and binary forms, with or without
    54# modification, are permitted provided that the following conditions are
    65# met:
    7 # 
    8 #     * Redistributions of source code must retain the above copyright
     6#
     7#    * Redistributions of source code must retain the above copyright
    98# notice, this list of conditions and the following disclaimer.
    10 #     * Redistributions in binary form must reproduce the above
     9#    * Redistributions in binary form must reproduce the above
    1110# copyright notice, this list of conditions and the following disclaimer
    1211# in the documentation and/or other materials provided with the
    1312# distribution.
    14 #     * Neither the name of Google Inc. nor the names of its
     13#    * Neither the name of Google Inc. nor the names of its
    1514# contributors may be used to endorse or promote products derived from
    1615# this software without specific prior written permission.
    17 # 
     16#
    1817# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1918# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    2827# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2928
     29import os
     30import subprocess
     31import StringIO
     32import tempfile
    3033import unittest
    3134
    32 from modules.bugzilla_unittest import *
    33 from modules.commiters_unittest import *
    34 from modules.cpp_style_unittest import *
    35 from modules.diff_parser_unittest import *
    36 from modules.scm_unittest import *
     35from modules.logging import *
     36from modules.scm import ScriptError
    3737
    38 if __name__ == "__main__":
     38class LoggingTest(unittest.TestCase):
     39
     40    def assert_log_equals(self, log_input, expected_output):
     41        original_stderr = sys.stderr
     42        test_stderr = StringIO.StringIO()
     43        sys.stderr = test_stderr
     44
     45        try:
     46            log(log_input)
     47            actual_output = test_stderr.getvalue()
     48        finally:
     49            original_stderr = original_stderr
     50
     51        self.assertEquals(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output))
     52
     53    def test_log(self):
     54        self.assert_log_equals("test", "test\n")
     55
     56        # Test that log() does not throw an exception when passed an object instead of a string.
     57        self.assert_log_equals(ScriptError("ScriptError"), "ScriptError\n")
     58
     59
     60if __name__ == '__main__':
    3961    unittest.main()
  • trunk/WebKitTools/Scripts/run-webkit-unittests

    r46898 r47040  
    3434from modules.cpp_style_unittest import *
    3535from modules.diff_parser_unittest import *
     36from modules.logging_unittest import *
    3637from modules.scm_unittest import *
    3738
Note: See TracChangeset for help on using the changeset viewer.