diff options
author | grv@chromium.org <grv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 02:21:40 +0000 |
---|---|---|
committer | grv@chromium.org <grv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-29 02:21:40 +0000 |
commit | 9d932a264161b89212ad3b0d3c5051360730849e (patch) | |
tree | b40c7e682360dae90bb536d27785ad6818016059 /tools/json_schema_compiler | |
parent | afaca13954a48ce4c98a2ff604e7597fa8e2b101 (diff) | |
download | chromium_src-9d932a264161b89212ad3b0d3c5051360730849e.zip chromium_src-9d932a264161b89212ad3b0d3c5051360730849e.tar.gz chromium_src-9d932a264161b89212ad3b0d3c5051360730849e.tar.bz2 |
Escape double quotes when parsing comments from idl files
BUG=132953
TEST=unittest
Review URL: https://chromiumcodereview.appspot.com/10669037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144863 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler')
-rw-r--r-- | tools/json_schema_compiler/idl_schema.py | 4 | ||||
-rwxr-xr-x | tools/json_schema_compiler/idl_schema_test.py | 4 | ||||
-rw-r--r-- | tools/json_schema_compiler/test/idl_basics.idl | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py index 5adfc1f..09b75a2 100644 --- a/tools/json_schema_compiler/idl_schema.py +++ b/tools/json_schema_compiler/idl_schema.py @@ -51,6 +51,10 @@ def ProcessComment(comment): } ) ''' + + # Escape double quotes. + comment = comment.replace('"', '\\"'); + # Find all the parameter comments of the form "|name|: comment". parameter_starts = list(re.finditer(r'\n *\|([^|]*)\| *: *', comment)) diff --git a/tools/json_schema_compiler/idl_schema_test.py b/tools/json_schema_compiler/idl_schema_test.py index d594de5..f83d616 100755 --- a/tools/json_schema_compiler/idl_schema_test.py +++ b/tools/json_schema_compiler/idl_schema_test.py @@ -89,6 +89,10 @@ class IdlSchemaTest(unittest.TestCase): 'name': 'arg', '$ref': 'idl_basics.MyType1'}], func['parameters']) + func = getFunction(schema, 'function4') + self.assertEquals(('This tests if \\\"double-quotes\\\" are escaped ' + 'correctly.'), + func['description']) if __name__ == '__main__': unittest.main() diff --git a/tools/json_schema_compiler/test/idl_basics.idl b/tools/json_schema_compiler/test/idl_basics.idl index e2ccd07..af5442e 100644 --- a/tools/json_schema_compiler/test/idl_basics.idl +++ b/tools/json_schema_compiler/test/idl_basics.idl @@ -36,6 +36,7 @@ namespace idl_basics { // <em>HTML</em> is fine too. static void function3(MyType1 arg); + // This tests if "double-quotes" are escaped correctly. static void function4(Callback1 cb); static void function5(Callback2 cb); static void function6(Callback3 cb); |