Revision: bf7f9afdec6f
Branch: default
Author: Tatu Kairi <tatu.ka...@eficode.com>
Date: Tue Apr 29 15:16:49 2014 UTC
Log: Added `encoding_errors` argument to `Log File` in Operating
System library
Update issue 1655
Status: Review
Implementation, tests and documentation done for `Log File` too.
http://code.google.com/p/robotframework/source/detail?r=bf7f9afdec6f
Modified:
/atest/robot/standard_libraries/operating_system/get_file.txt
/atest/testdata/standard_libraries/operating_system/get_file.txt
/src/robot/libraries/OperatingSystem.py
=======================================
--- /atest/robot/standard_libraries/operating_system/get_file.txt Tue Apr
29 09:49:23 2014 UTC
+++ /atest/robot/standard_libraries/operating_system/get_file.txt Tue Apr
29 15:16:49 2014 UTC
@@ -19,8 +19,14 @@
Check testcase ${TESTNAME}
Log File
- ${tc} = Check testcase ${TESTNAME}
- Check Log Message ${tc.kws[1].msgs[1]} hello world\nwith two lines
+ ${tc}= Check testcase ${TESTNAME}
+ Check Log Message ${tc.kws[1].msgs[1]} hello world\nwith two
lines
+
+Log File with default encoding and error handlers
+ ${tc}= Check testcase ${TESTNAME}
+ Log ${tc.kws[0].kws[0].msgs}
+ Check Log Message ${tc.kws[0].kws[0].msgs[1]} Hyv t
+ Check Log Message ${tc.kws[1].kws[0].msgs[1]} Hyv�� ��t�
Get Utf-8 File
Check testcase ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/operating_system/get_file.txt Tue
Apr 29 09:49:23 2014 UTC
+++ /atest/testdata/standard_libraries/operating_system/get_file.txt Tue
Apr 29 15:16:49 2014 UTC
@@ -40,9 +40,14 @@
Should Be Equal ${file} hello world\r\nbinary
Log File
- Create File ${TESTFILE} hello world\nwith two lines
- ${file} = Log File ${TESTFILE}
- Should Be Equal ${file} hello world\nwith two lines
+ Create File ${TESTFILE} hello world\nwith two lines
+ ${file}= Log File ${TESTFILE}
+ Should Be Equal ${file} hello world\nwith two lines
+
+Log File with default encoding and error handlers
+ [Template] Verify Log File with error handler
+ ignore Hyv t
+ replace Hyv�� ��t�
Get Utf-8 File
${file} = Get File ${UTF-8 FILE}
@@ -134,6 +139,11 @@
[Arguments] ${error handler} ${expected}
${ret}= Grep File ${LATIN-1 LONG FILE} f*a
encoding_errors=${error handler}
Should Be Equal ${ret} ${expected}
+
+Verify Log File with error handler
+ [Arguments] ${error handler} ${expected}
+ ${ret}= Log File ${LATIN-1 FILE} encoding_errors=${error
handler}
+ Should Be Equal ${ret} ${expected}
Verify Grep File With UTF-16 files
[Arguments] ${file} ${encoding} ${expected}
=======================================
--- /src/robot/libraries/OperatingSystem.py Tue Apr 29 09:51:52 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py Tue Apr 29 15:16:49 2014 UTC
@@ -385,14 +385,16 @@
self._info('%d out of %d lines matched' % (len(lines),
total_lines))
return '\n'.join(lines)
- def log_file(self, path, encoding='UTF-8'):
+ def log_file(self, path, encoding='UTF-8', encoding_errors='strict'):
"""Wrapper for `Get File` that also logs the returned file.
The file is logged with the INFO level. If you want something else,
just use `Get File` and the built-in keyword `Log` with the desired
level.
+
+ `encoding_errors` argument is new in Robot Framework 2.8.5.
"""
- content = self.get_file(path, encoding)
+ content = self.get_file(path, encoding, encoding_errors)
self._info(content)
return content
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.