4 new revisions:
Revision: 7b9bb75839e4
Author: Mikko Korpela <[email protected]>
Date: Fri Jun 3 12:46:48 2011
Log: do not use inefficent string concatenation
http://code.google.com/p/robotframework/source/detail?r=7b9bb75839e4
Revision: 53284ea6e955
Author: Mikko Korpela <[email protected]>
Date: Fri Jun 3 13:03:23 2011
Log: do not write directly to the file as it is very unefficent
http://code.google.com/p/robotframework/source/detail?r=53284ea6e955
Revision: cc2551276080
Author: Mikko Korpela <[email protected]>
Date: Sat Jun 4 10:43:46 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=cc2551276080
Revision: 128b6d974b9b
Author: Mikko Korpela <[email protected]>
Date: Sat Jun 4 10:52:18 2011
Log: Add rebot return code 0
http://code.google.com/p/robotframework/source/detail?r=128b6d974b9b
==============================================================================
Revision: 7b9bb75839e4
Author: Mikko Korpela <[email protected]>
Date: Fri Jun 3 12:46:48 2011
Log: do not use inefficent string concatenation
http://code.google.com/p/robotframework/source/detail?r=7b9bb75839e4
Modified:
/src/robot/serializing/jsparser.py
/utest/serializing/test_js_serializer.py
=======================================
--- /src/robot/serializing/jsparser.py Fri Jun 3 02:10:28 2011
+++ /src/robot/serializing/jsparser.py Fri Jun 3 12:46:48 2011
@@ -546,30 +546,23 @@
json_dump(self._texts, output)
output.write(';\n')
-def encode_basestring(string):
+def encode_and_write_basestring(string, output):
def get_matching_char(c):
- if c == '\\':
- return '\\\\'
- if c == '"':
- return '\\"'
- if c == '\b':
- return '\\b'
- if c == '\f':
- return '\\f'
- if c == '\n':
- return '\\n'
- if c == '\r':
- return '\\r'
- if c == '\t':
- return '\\t'
val = ord(c)
if val < 127 and val > 31:
return c
return '\\u' + hex(val)[2:].rjust(4,'0')
- result = '"'
+ string = string.replace('\\', '\\\\')
+ string = string.replace('"', '\\"')
+ string = string.replace('\b', '\\b')
+ string = string.replace('\f', '\\f')
+ string = string.replace('\n', '\\n')
+ string = string.replace('\r', '\\r')
+ string = string.replace('\t', '\\t')
+ output.write('"')
for c in string:
- result += get_matching_char(c)
- return result+'"'
+ output.write(get_matching_char(c))
+ output.write('"')
def json_dump(data, output):
if isinstance(data, int):
@@ -577,7 +570,7 @@
elif isinstance(data, long):
output.write(str(data))
elif isinstance(data, basestring):
- output.write(encode_basestring(data))
+ encode_and_write_basestring(data, output)
elif isinstance(data, list):
output.write('[')
for index, item in enumerate(data):
=======================================
--- /utest/serializing/test_js_serializer.py Thu Jun 2 21:39:47 2011
+++ /utest/serializing/test_js_serializer.py Fri Jun 3 12:46:48 2011
@@ -165,13 +165,21 @@
assert_equals(data_model._texts, ['*', "*Invalid syntax in
file '/tmp/data/failing_suite.txt' in table 'Settings': Resource
file 'nope' does not exist."])
def test_json_dump_string(self):
+ from time import time
string = u'string\u00A9\v\\\'\"\r\b\t\0\n\fjee'
for i in range(1024):
string += unichr(i)
+ #string = string * 10
buffer = StringIO.StringIO()
+ #s = time()
json_dump(string, buffer)
+ #e = time()
+ #print 'json_dump %s' % (e - s)
expected = StringIO.StringIO()
+ #s = time()
json.dump(string, expected)
+ #e = time()
+ #print 'json.dump %s' % (e - s)
self._assert_long_equals(buffer.getvalue(), expected.getvalue())
def test_json_dump_integer(self):
==============================================================================
Revision: 53284ea6e955
Author: Mikko Korpela <[email protected]>
Date: Fri Jun 3 13:03:23 2011
Log: do not write directly to the file as it is very unefficent
http://code.google.com/p/robotframework/source/detail?r=53284ea6e955
Modified:
/src/robot/serializing/jsparser.py
=======================================
--- /src/robot/serializing/jsparser.py Fri Jun 3 12:46:48 2011
+++ /src/robot/serializing/jsparser.py Fri Jun 3 13:03:23 2011
@@ -1,4 +1,5 @@
from __future__ import with_statement
+import StringIO
import xml.sax as sax
from xml.sax.handler import ContentHandler
import zlib
@@ -546,7 +547,7 @@
json_dump(self._texts, output)
output.write(';\n')
-def encode_and_write_basestring(string, output):
+def encode_basestring(string):
def get_matching_char(c):
val = ord(c)
if val < 127 and val > 31:
@@ -559,10 +560,10 @@
string = string.replace('\n', '\\n')
string = string.replace('\r', '\\r')
string = string.replace('\t', '\\t')
- output.write('"')
+ result = StringIO.StringIO()
for c in string:
- output.write(get_matching_char(c))
- output.write('"')
+ result.write(get_matching_char(c))
+ return '"'+result.getvalue()+'"'
def json_dump(data, output):
if isinstance(data, int):
@@ -570,7 +571,7 @@
elif isinstance(data, long):
output.write(str(data))
elif isinstance(data, basestring):
- encode_and_write_basestring(data, output)
+ output.write(encode_basestring(data))
elif isinstance(data, list):
output.write('[')
for index, item in enumerate(data):
==============================================================================
Revision: cc2551276080
Author: Mikko Korpela <[email protected]>
Date: Sat Jun 4 10:43:46 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=cc2551276080
==============================================================================
Revision: 128b6d974b9b
Author: Mikko Korpela <[email protected]>
Date: Sat Jun 4 10:52:18 2011
Log: Add rebot return code 0
http://code.google.com/p/robotframework/source/detail?r=128b6d974b9b
Modified:
/src/robot/__init__.py
=======================================
--- /src/robot/__init__.py Fri Jun 3 04:22:38 2011
+++ /src/robot/__init__.py Sat Jun 4 10:52:18 2011
@@ -157,7 +157,11 @@
LOGGER.disable_message_cache()
Reporter().execute(settings, *datasources)
LOGGER.close()
- return 0 #FIXME! Can't identify number of failed suites
+ class RebotSuite(object):
+ @property
+ def return_code(self):
+ return 0
+ return RebotSuite() #TODO identify number of failed suites if needed
def _report_error(message, details=None, help=False):