Issue #269: Tests when renaming registy subKey(s) jv
authorPatrik Svestka <patrik.svestka@gmail.com>
Tue, 09 Apr 2019 11:18:28 +0200
branchjv
changeset 2214 ba58ef8a6214
parent 2096 aecb2604da9c
child 2592 7aa9af5b0ddb
Issue #269: Tests when renaming registy subKey(s)
RegressionTests__Win32OperatingSystemTest.st
--- a/RegressionTests__Win32OperatingSystemTest.st	Thu Feb 21 13:23:54 2019 +0000
+++ b/RegressionTests__Win32OperatingSystemTest.st	Tue Apr 09 11:18:28 2019 +0200
@@ -2505,6 +2505,73 @@
     "Modified (format): / 01-02-2019 / 13:32:02 / svestkap"
 ! !
 
+!Win32OperatingSystemTest methodsFor:'tests-unicodeRename'!
+
+testRenameSubKey_01
+    "Testing if subKey is correctly renamed"
+    | readData testingRegistryEntryPath |   
+
+    testingRegistryEntryPath := Win32OperatingSystem registryEntry key: registryPath.
+    
+    self assert: (testingRegistryEntryPath renameSubKey: ' ルすしか_testing_delete'  to: 'RenamedSubKey').
+    readData := testingRegistryEntryPath subKeyNamed: 'RenamedSubKey'.
+    
+    self assert: readData notEmptyOrNil.
+    self assert: readData path = (registryPath, '\', 'RenamedSubKey').
+
+    "
+     self run:#testRenameSubKey_01
+     self new testRenameSubKey_01
+    "
+
+    "Created: / 09-04-2019 / 09:05:28 / svestkap"
+!
+
+testRenameSubKey_02
+    "Testing if subKey is correctly renamed"
+    | readData testingRegistryEntryPath |   
+
+    testingRegistryEntryPath := Win32OperatingSystem registryEntry key: registryPath.
+    
+    self assert: (testingRegistryEntryPath renameSubKey: ' ルすしか_testing_delete'  to: 'すしか_').
+    readData := testingRegistryEntryPath subKeyNamed: 'すしか_'.
+    
+    self assert: readData notEmptyOrNil.
+    self assert: readData path = (registryPath, '\', 'すしか_').
+
+    testingRegistryEntryPath := Win32OperatingSystem registryEntry key: (registryPath, '\', 'すしか_').
+    readData := testingRegistryEntryPath subKeyNamed: 'bobr'.
+    
+    self assert: readData notEmptyOrNil.
+    self assert: readData path = (registryPath, '\', 'すしか_', '\', 'bobr')
+    
+    "
+     self run:#testRenameSubKey_02
+     self new testRenameSubKey_02
+    "
+
+    "Created: / 09-04-2019 / 09:35:05 / svestkap"
+!
+
+testRenameSubKey_03
+    "Testing when renamed subKey does not exist"
+    | readData testingRegistryEntryPath |   
+
+    testingRegistryEntryPath := Win32OperatingSystem registryEntry key: registryPath.
+    
+    self deny: (testingRegistryEntryPath renameSubKey: 'a key that does not exist'  to: 'すしか_').
+    readData := testingRegistryEntryPath subKeyNamed: 'すしか_'.
+    
+    self assert: readData isEmptyOrNil
+    
+    "
+     self run:#testRenameSubKey_03
+     self new testRenameSubKey_03
+    "
+
+    "Created: / 09-04-2019 / 09:39:52 / svestkap"
+! !
+
 !Win32OperatingSystemTest methodsFor:'tests-unicodeWrite'!
 
 testDefaultValue_01