3 new revisions:

Revision: feef1730f5f2
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:40:17 2014 UTC
Log:      OperatingSystem: Move/Copy File: work with glob patterns
http://code.google.com/p/robotframework/source/detail?r=feef1730f5f2

Revision: 36d67ee41c0f
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:45:05 2014 UTC
Log:      tests for no matches at all
http://code.google.com/p/robotframework/source/detail?r=36d67ee41c0f

Revision: 25784950ec01
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:47:37 2014 UTC
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=25784950ec01

==============================================================================
Revision: feef1730f5f2
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:40:17 2014 UTC
Log:      OperatingSystem: Move/Copy File: work with glob patterns
http://code.google.com/p/robotframework/source/detail?r=feef1730f5f2

Modified:
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
 /src/robot/libraries/OperatingSystem.py

=======================================
--- /atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 08:47:54 2014 UTC +++ /atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:40:17 2014 UTC
@@ -10,6 +10,18 @@

 Copy File
     Check testcase  ${TESTNAME}
+
+Copy File With Glob Pattern
+    Check testcase  ${TESTNAME}
+
+Move File With Glob Pattern
+    Check testcase  ${TESTNAME}
+
+Copy File With Glob Pattern With Multiple Matches Fails
+    Check testcase  ${TESTNAME}
+
+Move File With Glob Pattern With Multiple Matches Fails
+    Check testcase  ${TESTNAME}

 Copy File when destination exists should be ok
     Check testcase  ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 08:47:54 2014 UTC +++ /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:40:17 2014 UTC
@@ -21,6 +21,30 @@
     Copy File  ${TESTFILE}  ${TESTFILE2}
     Verify File  ${TESTFILE2}  contents
Directory Should Have Items ${BASE} ${TESTFILE SHORT NAME} ${TESTFILE 2 SHORT NAME}
+
+Copy File With Glob Pattern
+    Create File  ${BASE}/somefile.txt  contents
+    Copy File  ${BASE}/som*i??.txt  ${TESTFILE}
+    Verify File  ${TESTFILE}  contents
+ Directory Should Have Items ${BASE} ${TESTFILE SHORT NAME} somefile.txt
+
+Move File With Glob Pattern
+    Create File  ${BASE}/somefile.txt  contents
+    Move File  ${BASE}/s?me?i??.txt  ${TESTFILE}
+    Verify File  ${TESTFILE}  contents
+    Should Not Exist  ${BASE}/somefile.txt
+
+Move File With Glob Pattern With Multiple Matches Fails
+ [Documentation] FAIL REGEXP: Multiple matches with source pattern '.*file\\*\\.txt'
+    Create File  ${BASE}/file1.txt  contents
+    Create File  ${BASE}/file2.txt  contents
+    Move File   ${BASE}/file*.txt   somewhere
+
+Copy File With Glob Pattern With Multiple Matches Fails
+ [Documentation] FAIL REGEXP: Multiple matches with source pattern '.*file\\*\\.txt'
+    Create File  ${BASE}/file1.txt  contents
+    Create File  ${BASE}/file2.txt  contentshg
+    Copy File   ${BASE}/file*.txt   somewhere

 Copy File when destination exists should be ok
     Create File  ${TESTFILE}  contents
@@ -76,7 +100,7 @@
     [Teardown]  Remove Files  rf_test.1  rf_test.2

 Moving Non-Existing File Fails
- [Documentation] FAIL REGEXP: Source file '${ANYDIR}non-existing-file.txt' does not exist + [Documentation] FAIL REGEXP: Source file 'non-existing-file.txt' does not exist
     Move File  non-existing-file.txt  whatever.txt

 Move Directory
=======================================
--- /src/robot/libraries/OperatingSystem.py     Wed Jan 29 08:47:54 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py     Wed Jan 29 11:40:17 2014 UTC
@@ -816,7 +816,10 @@
         return self._atomic_copy(source, dest, parent)

     def _normalize_source_and_dest(self, source, dest):
-        source = self._absnorm(source)
+        sources = self._glob_files([source])
+        if len(sources) > 1:
+ raise RuntimeError("Multiple matches with source pattern '%s'" % source)
+        source = sources[0] if sources else source
         dest, dest_is_dir = self._normalize_dest(dest)
         return source, dest, dest_is_dir


==============================================================================
Revision: 36d67ee41c0f
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:45:05 2014 UTC
Log:      tests for no matches at all
http://code.google.com/p/robotframework/source/detail?r=36d67ee41c0f

Modified:
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt

=======================================
--- /atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:40:17 2014 UTC +++ /atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:45:05 2014 UTC
@@ -22,6 +22,12 @@

 Move File With Glob Pattern With Multiple Matches Fails
     Check testcase  ${TESTNAME}
+
+Copy File With Glob Pattern With No Matches Fails
+    Check testcase  ${TESTNAME}
+
+Move File With Glob Pattern With No Matches Fails
+    Check testcase  ${TESTNAME}

 Copy File when destination exists should be ok
     Check testcase  ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:40:17 2014 UTC +++ /atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt Wed Jan 29 11:45:05 2014 UTC
@@ -43,9 +43,18 @@
 Copy File With Glob Pattern With Multiple Matches Fails
[Documentation] FAIL REGEXP: Multiple matches with source pattern '.*file\\*\\.txt'
     Create File  ${BASE}/file1.txt  contents
-    Create File  ${BASE}/file2.txt  contentshg
+    Create File  ${BASE}/file2.txt  contents
     Copy File   ${BASE}/file*.txt   somewhere

+
+Copy File With Glob Pattern With No Matches Fails
+    [Documentation]  FAIL Source file 'zoo*bar*not*here' does not exist
+    Copy File   zoo*bar*not*here    somewhere
+
+Move File With Glob Pattern With No Matches Fails
+    [Documentation]  FAIL Source file 'foo*bar?zoo*not*here' does not exist
+    Move File   foo*bar?zoo*not*here    somewhere
+
 Copy File when destination exists should be ok
     Create File  ${TESTFILE}  contents
     Copy File  ${TESTFILE}  ${TESTFILE2}

==============================================================================
Revision: 25784950ec01
Branch:   default
Author:   Mikko Korpela <mikko.korp...@gmail.com>
Date:     Wed Jan 29 11:47:37 2014 UTC
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=25784950ec01


--

--- 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/groups/opt_out.

Reply via email to